[PATCH v2] Static correctness
Lukas Fleischer
cgit at cryptocrack.de
Sat Jan 14 22:24:27 CET 2012
Spotted by parsing the output of GCC with "-Wmissing-prototypes" and
comparing it against the prototypes defined in our header files.
Signed-off-by: Lukas Fleischer <cgit at cryptocrack.de>
---
Rebased on current master.
cgit.c | 14 +++++++-------
configfile.c | 6 +++---
html.c | 2 +-
parsing.c | 2 +-
shared.c | 6 +++---
ui-atom.c | 2 +-
ui-log.c | 6 +++---
ui-repolist.c | 14 +++++++-------
ui-shared.c | 2 +-
ui-snapshot.c | 2 +-
ui-stats.c | 4 ++--
ui-tag.c | 2 +-
12 files changed, 31 insertions(+), 31 deletions(-)
diff --git a/cgit.c b/cgit.c
index 1d50129..5851445 100644
--- a/cgit.c
+++ b/cgit.c
@@ -18,7 +18,7 @@
const char *cgit_version = CGIT_VERSION;
-void add_mimetype(const char *name, const char *value)
+static void add_mimetype(const char *name, const char *value)
{
struct string_list_item *item;
@@ -58,7 +58,7 @@ struct cgit_filter *new_filter(const char *cmd, filter_type filtertype)
static void process_cached_repolist(const char *path);
-void repo_config(struct cgit_repo *repo, const char *name, const char *value)
+static void repo_config(struct cgit_repo *repo, const char *name, const char *value)
{
if (!strcmp(name, "name"))
repo->name = xstrdup(value);
@@ -104,7 +104,7 @@ void repo_config(struct cgit_repo *repo, const char *name, const char *value)
}
}
-void config_cb(const char *name, const char *value)
+static void config_cb(const char *name, const char *value)
{
if (!strcmp(name, "section") || !strcmp(name, "repo.group"))
ctx.cfg.section = xstrdup(value);
@@ -386,7 +386,7 @@ struct refmatch {
int match;
};
-int find_current_ref(const char *refname, const unsigned char *sha1,
+static int find_current_ref(const char *refname, const unsigned char *sha1,
int flags, void *cb_data)
{
struct refmatch *info;
@@ -527,7 +527,7 @@ static void process_request(void *cbdata)
cgit_print_docend();
}
-int cmp_repos(const void *a, const void *b)
+static int cmp_repos(const void *a, const void *b)
{
const struct cgit_repo *ra = a, *rb = b;
return strcmp(ra->url, rb->url);
@@ -562,7 +562,7 @@ char *get_first_line(char *txt)
return t;
}
-void print_repo(FILE *f, struct cgit_repo *repo)
+static void print_repo(FILE *f, struct cgit_repo *repo)
{
fprintf(f, "repo.url=%s\n", repo->url);
fprintf(f, "repo.name=%s\n", repo->name);
@@ -607,7 +607,7 @@ void print_repo(FILE *f, struct cgit_repo *repo)
fprintf(f, "\n");
}
-void print_repolist(FILE *f, struct cgit_repolist *list, int start)
+static void print_repolist(FILE *f, struct cgit_repolist *list, int start)
{
int i;
diff --git a/configfile.c b/configfile.c
index 4908058..1c825ed 100644
--- a/configfile.c
+++ b/configfile.c
@@ -10,7 +10,7 @@
#include <stdio.h>
#include "configfile.h"
-int next_char(FILE *f)
+static int next_char(FILE *f)
{
int c = fgetc(f);
if (c=='\r') {
@@ -23,7 +23,7 @@ int next_char(FILE *f)
return c;
}
-void skip_line(FILE *f)
+static void skip_line(FILE *f)
{
int c;
@@ -31,7 +31,7 @@ void skip_line(FILE *f)
;
}
-int read_config_line(FILE *f, char *line, const char **value, int bufsize)
+static int read_config_line(FILE *f, char *line, const char **value, int bufsize)
{
int i = 0, isname = 0;
diff --git a/html.c b/html.c
index 8f6e4f6..a5277dc 100644
--- a/html.c
+++ b/html.c
@@ -266,7 +266,7 @@ int html_include(const char *filename)
return 0;
}
-int hextoint(char c)
+static int hextoint(char c)
{
if (c >= 'a' && c <= 'f')
return 10 + c - 'a';
diff --git a/parsing.c b/parsing.c
index 602e3de..a4c95d9 100644
--- a/parsing.c
+++ b/parsing.c
@@ -99,7 +99,7 @@ char *parse_user(char *t, char **name, char **email, unsigned long *date)
#ifdef NO_ICONV
#define reencode(a, b, c)
#else
-const char *reencode(char **txt, const char *src_enc, const char *dst_enc)
+static const char *reencode(char **txt, const char *src_enc, const char *dst_enc)
{
char *tmp;
diff --git a/shared.c b/shared.c
index 0c8ce3e..0c8004d 100644
--- a/shared.c
+++ b/shared.c
@@ -185,7 +185,7 @@ int cgit_refs_cb(const char *refname, const unsigned char *sha1, int flags,
return 0;
}
-void cgit_diff_tree_cb(struct diff_queue_struct *q,
+static void cgit_diff_tree_cb(struct diff_queue_struct *q,
struct diff_options *options, void *data)
{
int i;
@@ -222,7 +222,7 @@ static int load_mmfile(mmfile_t *file, const unsigned char *sha1)
char *diffbuf = NULL;
int buflen = 0;
-int filediff_cb(void *priv, mmbuffer_t *mb, int nbuf)
+static int filediff_cb(void *priv, mmbuffer_t *mb, int nbuf)
{
int i;
@@ -459,7 +459,7 @@ int readfile(const char *path, char **buf, size_t *size)
return (*size == st.st_size ? 0 : e);
}
-int is_token_char(char c)
+static int is_token_char(char c)
{
return isalnum(c) || c == '_';
}
diff --git a/ui-atom.c b/ui-atom.c
index b218456..5b5525d 100644
--- a/ui-atom.c
+++ b/ui-atom.c
@@ -10,7 +10,7 @@
#include "html.h"
#include "ui-shared.h"
-void add_entry(struct commit *commit, char *host)
+static void add_entry(struct commit *commit, char *host)
{
char delim = '&';
char *hex;
diff --git a/ui-log.c b/ui-log.c
index 6b12ca2..7b3f374 100644
--- a/ui-log.c
+++ b/ui-log.c
@@ -28,7 +28,7 @@ static const char *column_colors_html[] = {
#define COLUMN_COLORS_HTML_MAX (ARRAY_SIZE(column_colors_html) - 1)
-void count_lines(char *line, int size)
+static void count_lines(char *line, int size)
{
if (size <= 0)
return;
@@ -40,7 +40,7 @@ void count_lines(char *line, int size)
rem_lines++;
}
-void inspect_files(struct diff_filepair *pair)
+static void inspect_files(struct diff_filepair *pair)
{
unsigned long old_size = 0;
unsigned long new_size = 0;
@@ -95,7 +95,7 @@ next:
}
}
-void print_commit(struct commit *commit, struct rev_info *revs)
+static void print_commit(struct commit *commit, struct rev_info *revs)
{
struct commitinfo *info;
int cols = revs->graph ? 3 : 2;
diff --git a/ui-repolist.c b/ui-repolist.c
index a09a689..f168da2 100644
--- a/ui-repolist.c
+++ b/ui-repolist.c
@@ -10,7 +10,7 @@
#include "html.h"
#include "ui-shared.h"
-time_t read_agefile(char *path)
+static time_t read_agefile(char *path)
{
time_t result;
size_t size;
@@ -71,7 +71,7 @@ static void print_modtime(struct cgit_repo *repo)
cgit_print_age(t, -1, NULL);
}
-int is_match(struct cgit_repo *repo)
+static int is_match(struct cgit_repo *repo)
{
if (!ctx.qry.search)
return 1;
@@ -86,7 +86,7 @@ int is_match(struct cgit_repo *repo)
return 0;
}
-int is_in_url(struct cgit_repo *repo)
+static int is_in_url(struct cgit_repo *repo)
{
if (!ctx.qry.url)
return 1;
@@ -95,7 +95,7 @@ int is_in_url(struct cgit_repo *repo)
return 0;
}
-void print_sort_header(const char *title, const char *sort)
+static void print_sort_header(const char *title, const char *sort)
{
htmlf("<th class='left'><a href='%s?s=%s", cgit_rooturl(), sort);
if (ctx.qry.search) {
@@ -105,7 +105,7 @@ void print_sort_header(const char *title, const char *sort)
htmlf("'>%s</a></th>", title);
}
-void print_header(int columns)
+static void print_header(int columns)
{
html("<tr class='nohover'>");
print_sort_header("Name", "name");
@@ -118,7 +118,7 @@ void print_header(int columns)
}
-void print_pager(int items, int pagelen, char *search, char *sort)
+static void print_pager(int items, int pagelen, char *search, char *sort)
{
int i;
html("<div class='pager'>");
@@ -201,7 +201,7 @@ struct sortcolumn sortcolumn[] = {
{NULL, NULL}
};
-int sort_repolist(char *field)
+static int sort_repolist(char *field)
{
struct sortcolumn *column;
diff --git a/ui-shared.c b/ui-shared.c
index 3e9282f..44cd3ee 100644
--- a/ui-shared.c
+++ b/ui-shared.c
@@ -656,7 +656,7 @@ void cgit_print_docend()
html("</body>\n</html>\n");
}
-int print_branch_option(const char *refname, const unsigned char *sha1,
+static int print_branch_option(const char *refname, const unsigned char *sha1,
int flags, void *cb_data)
{
char *name = (char *)refname;
diff --git a/ui-snapshot.c b/ui-snapshot.c
index 07cc944..9c512db 100644
--- a/ui-snapshot.c
+++ b/ui-snapshot.c
@@ -140,7 +140,7 @@ static const char *get_ref_from_filename(const char *url, const char *filename,
return NULL;
}
-void show_error(char *msg)
+static void show_error(char *msg)
{
ctx.page.mimetype = "text/html";
cgit_print_http_headers(&ctx);
diff --git a/ui-stats.c b/ui-stats.c
index 59f4c1e..ebbb7d7 100644
--- a/ui-stats.c
+++ b/ui-stats.c
@@ -253,7 +253,7 @@ struct string_list collect_stats(struct cgit_context *ctx,
return authors;
}
-void print_combined_authorrow(struct string_list *authors, int from, int to,
+static void print_combined_authorrow(struct string_list *authors, int from, int to,
const char *name, const char *leftclass, const char *centerclass,
const char *rightclass, struct cgit_period *period)
{
@@ -293,7 +293,7 @@ void print_combined_authorrow(struct string_list *authors, int from, int to,
htmlf("<td class='%s'>%ld</td></tr>", rightclass, total);
}
-void print_authors(struct string_list *authors, int top,
+static void print_authors(struct string_list *authors, int top,
struct cgit_period *period)
{
struct string_list_item *author;
diff --git a/ui-tag.c b/ui-tag.c
index 39e4cb8..f040707 100644
--- a/ui-tag.c
+++ b/ui-tag.c
@@ -30,7 +30,7 @@ static void print_tag_content(char *buf)
}
}
-void print_download_links(char *revname)
+static void print_download_links(char *revname)
{
html("<tr><th>download</th><td class='sha1'>");
cgit_print_snapshot_links(ctx.qry.repo, ctx.qry.head,
--
1.7.8.3
More information about the CGit
mailing list