[PATCH] Always #include corresponding .h in .c files

John Keeping john at keeping.me.uk
Sat Apr 6 12:37:59 CEST 2013


While doing this, remove declarations from header files where the
corresponding definition is declared "static" in order to avoid build
errors.

Also re-order existing headers in ui-*.c so that the file-specific
header always comes immediately after "cgit.h", helping with future
consistency.

Signed-off-by: John Keeping <john at keeping.me.uk>
---
 html.c        | 1 +
 html.h        | 2 --
 scan-tree.c   | 1 +
 ui-atom.c     | 1 +
 ui-blob.c     | 1 +
 ui-clone.c    | 1 +
 ui-commit.c   | 1 +
 ui-diff.c     | 1 +
 ui-diff.h     | 3 ---
 ui-log.c      | 1 +
 ui-patch.c    | 1 +
 ui-plain.c    | 1 +
 ui-refs.c     | 1 +
 ui-repolist.c | 1 +
 ui-shared.c   | 1 +
 ui-shared.h   | 2 --
 ui-snapshot.c | 1 +
 ui-ssdiff.c   | 2 +-
 ui-stats.c    | 2 +-
 ui-summary.c  | 1 +
 ui-tag.c      | 1 +
 ui-tree.c     | 1 +
 22 files changed, 19 insertions(+), 9 deletions(-)

diff --git a/html.c b/html.c
index d60a41f..1104f97 100644
--- a/html.c
+++ b/html.c
@@ -6,6 +6,7 @@
  *   (see COPYING for full license text)
  */
 
+#include "html.h"
 #include <unistd.h>
 #include <stdio.h>
 #include <stdlib.h>
diff --git a/html.h b/html.h
index 20e1dc2..b89cf94 100644
--- a/html.h
+++ b/html.h
@@ -1,8 +1,6 @@
 #ifndef HTML_H
 #define HTML_H
 
-extern int htmlfd;
-
 extern void html_raw(const char *txt, size_t size);
 extern void html(const char *txt);
 
diff --git a/scan-tree.c b/scan-tree.c
index 10d90f4..0d3e0ad 100644
--- a/scan-tree.c
+++ b/scan-tree.c
@@ -8,6 +8,7 @@
  */
 
 #include "cgit.h"
+#include "scan-tree.h"
 #include "configfile.h"
 #include "html.h"
 
diff --git a/ui-atom.c b/ui-atom.c
index 5b5525d..8122fae 100644
--- a/ui-atom.c
+++ b/ui-atom.c
@@ -7,6 +7,7 @@
  */
 
 #include "cgit.h"
+#include "ui-atom.h"
 #include "html.h"
 #include "ui-shared.h"
 
diff --git a/ui-blob.c b/ui-blob.c
index c59fbcb..0c6c215 100644
--- a/ui-blob.c
+++ b/ui-blob.c
@@ -8,6 +8,7 @@
  */
 
 #include "cgit.h"
+#include "ui-blob.h"
 #include "html.h"
 #include "ui-shared.h"
 
diff --git a/ui-clone.c b/ui-clone.c
index fdea24f..30d020e 100644
--- a/ui-clone.c
+++ b/ui-clone.c
@@ -8,6 +8,7 @@
  */
 
 #include "cgit.h"
+#include "ui-clone.h"
 #include "html.h"
 #include "ui-shared.h"
 
diff --git a/ui-commit.c b/ui-commit.c
index 0783285..105ef13 100644
--- a/ui-commit.c
+++ b/ui-commit.c
@@ -7,6 +7,7 @@
  */
 
 #include "cgit.h"
+#include "ui-commit.h"
 #include "html.h"
 #include "ui-shared.h"
 #include "ui-diff.h"
diff --git a/ui-diff.c b/ui-diff.c
index 7de7802..1115518 100644
--- a/ui-diff.c
+++ b/ui-diff.c
@@ -7,6 +7,7 @@
  */
 
 #include "cgit.h"
+#include "ui-diff.h"
 #include "html.h"
 #include "ui-shared.h"
 #include "ui-ssdiff.h"
diff --git a/ui-diff.h b/ui-diff.h
index 0161ffb..25a9296 100644
--- a/ui-diff.h
+++ b/ui-diff.h
@@ -3,9 +3,6 @@
 
 extern void cgit_print_diff_ctrls();
 
-extern void cgit_print_diffstat(const unsigned char *old_sha1,
-				const unsigned char *new_sha1);
-
 extern void cgit_print_diff(const char *new_hex, const char *old_hex,
 			    const char *prefix, int show_ctrls);
 
diff --git a/ui-log.c b/ui-log.c
index aaffb4e..d75d7bf 100644
--- a/ui-log.c
+++ b/ui-log.c
@@ -7,6 +7,7 @@
  */
 
 #include "cgit.h"
+#include "ui-log.h"
 #include "html.h"
 #include "ui-shared.h"
 #include "vector.h"
diff --git a/ui-patch.c b/ui-patch.c
index 12abe10..66def3c 100644
--- a/ui-patch.c
+++ b/ui-patch.c
@@ -7,6 +7,7 @@
  */
 
 #include "cgit.h"
+#include "ui-patch.h"
 #include "html.h"
 #include "ui-shared.h"
 
diff --git a/ui-plain.c b/ui-plain.c
index 8ef4ec6..4397a59 100644
--- a/ui-plain.c
+++ b/ui-plain.c
@@ -8,6 +8,7 @@
 
 #include <stdio.h>
 #include "cgit.h"
+#include "ui-plain.h"
 #include "html.h"
 #include "ui-shared.h"
 
diff --git a/ui-refs.c b/ui-refs.c
index 45db2ac..5bebed1 100644
--- a/ui-refs.c
+++ b/ui-refs.c
@@ -7,6 +7,7 @@
  */
 
 #include "cgit.h"
+#include "ui-refs.h"
 #include "html.h"
 #include "ui-shared.h"
 
diff --git a/ui-repolist.c b/ui-repolist.c
index a9751f6..76fe71a 100644
--- a/ui-repolist.c
+++ b/ui-repolist.c
@@ -8,6 +8,7 @@
  */
 
 #include "cgit.h"
+#include "ui-repolist.h"
 #include "html.h"
 #include "ui-shared.h"
 #include <strings.h>
diff --git a/ui-shared.c b/ui-shared.c
index d4fb3d9..4fb30b4 100644
--- a/ui-shared.c
+++ b/ui-shared.c
@@ -7,6 +7,7 @@
  */
 
 #include "cgit.h"
+#include "ui-shared.h"
 #include "cmd.h"
 #include "html.h"
 
diff --git a/ui-shared.h b/ui-shared.h
index 87a7dac..5936b09 100644
--- a/ui-shared.h
+++ b/ui-shared.h
@@ -47,8 +47,6 @@ extern void cgit_diff_link(const char *name, const char *title,
 extern void cgit_stats_link(const char *name, const char *title,
 			    const char *class, const char *head,
 			    const char *path);
-extern void cgit_self_link(char *name, const char *title,
-			   const char *class, struct cgit_context *ctx);
 extern void cgit_object_link(struct object *obj);
 
 extern void cgit_submodule_link(const char *class, char *path,
diff --git a/ui-snapshot.c b/ui-snapshot.c
index e199a92..9be5dbe 100644
--- a/ui-snapshot.c
+++ b/ui-snapshot.c
@@ -8,6 +8,7 @@
  */
 
 #include "cgit.h"
+#include "ui-snapshot.h"
 #include "html.h"
 #include "ui-shared.h"
 
diff --git a/ui-ssdiff.c b/ui-ssdiff.c
index 3d3dad6..cbe60bd 100644
--- a/ui-ssdiff.c
+++ b/ui-ssdiff.c
@@ -1,8 +1,8 @@
 #include "cgit.h"
+#include "ui-ssdiff.h"
 #include "html.h"
 #include "ui-shared.h"
 #include "ui-diff.h"
-#include "ui-ssdiff.h"
 
 extern int use_ssdiff;
 
diff --git a/ui-stats.c b/ui-stats.c
index 480c8ee..52e9b91 100644
--- a/ui-stats.c
+++ b/ui-stats.c
@@ -1,7 +1,7 @@
 #include "cgit.h"
+#include "ui-stats.h"
 #include "html.h"
 #include "ui-shared.h"
-#include "ui-stats.h"
 
 #ifdef NO_C99_FORMAT
 #define SZ_FMT "%u"
diff --git a/ui-summary.c b/ui-summary.c
index 0754bb7..bd123ef 100644
--- a/ui-summary.c
+++ b/ui-summary.c
@@ -8,6 +8,7 @@
  */
 
 #include "cgit.h"
+#include "ui-summary.h"
 #include "html.h"
 #include "ui-log.h"
 #include "ui-refs.h"
diff --git a/ui-tag.c b/ui-tag.c
index 4d340d4..5a22696 100644
--- a/ui-tag.c
+++ b/ui-tag.c
@@ -7,6 +7,7 @@
  */
 
 #include "cgit.h"
+#include "ui-tag.h"
 #include "html.h"
 #include "ui-shared.h"
 
diff --git a/ui-tree.c b/ui-tree.c
index b692b56..d713553 100644
--- a/ui-tree.c
+++ b/ui-tree.c
@@ -8,6 +8,7 @@
 
 #include <ctype.h>
 #include "cgit.h"
+#include "ui-tree.h"
 #include "html.h"
 #include "ui-shared.h"
 
-- 
1.8.2.452.gb520e27





More information about the CGit mailing list