Author: Lukas Fleischer <cgit@cryptocrack.de>
Mark several functions/variables static Spotted by parsing the output of `gcc -Wmissing-prototypes [...]`. Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
cache.c | 2 +- cgit.c | 26 +++++++++++++------------- configfile.c | 6 +++--- html.c | 6 +++--- parsing.c | 6 +++--- shared.c | 12 ++++++------ ui-atom.c | 2 +- ui-diff.c | 5 +++-- ui-log.c | 6 +++--- ui-repolist.c | 14 +++++++------- ui-shared.c | 18 +++++++++--------- ui-snapshot.c | 2 +- ui-stats.c | 17 ++++++++++------- ui-tag.c | 2 +-
diff --git a/cache.c b/cache.c index 47cdcb44d5ccdfe9bf95c4a8b7af94ded87bfcf4..3127fc26366ba35363f81abc35cf579f07e7d612 100644 --- a/cache.c +++ b/cache.c @@ -363,7 +363,7 @@ /* Return a strftime formatted date/time * NB: the result from this function is to shared memory */ -char *sprintftime(const char *format, time_t time) +static char *sprintftime(const char *format, time_t time) { static char buf[64]; struct tm *tm; diff --git a/cgit.c b/cgit.c index 2ccf8646a5e5867632b5dcf6b2e15cbacd16f9f1..5b20de3dd5d66fbc635edeb37bd1b589b21fc676 100644 --- a/cgit.c +++ b/cgit.c @@ -18,7 +18,7 @@ #include "scan-tree.h" 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; @@ -26,7 +26,7 @@ item = string_list_insert(&ctx.cfg.mimetypes, xstrdup(name)); item->util = xstrdup(value); } -struct cgit_filter *new_filter(const char *cmd, filter_type filtertype) +static struct cgit_filter *new_filter(const char *cmd, filter_type filtertype) { struct cgit_filter *f; int args_size = 0; @@ -58,7 +58,7 @@ } 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) { struct string_list_item *item; @@ -114,7 +114,7 @@ repo->source_filter = new_filter(value, SOURCE); } } -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); @@ -333,7 +333,7 @@ ctx.qry.ignorews = atoi(value); } } -char *xstrdupn(const char *str) +static char *xstrdupn(const char *str) { return (str ? xstrdup(str) : NULL); } @@ -414,8 +414,8 @@ char *first_ref; int match; }; -int find_current_ref(const char *refname, const unsigned char *sha1, - int flags, void *cb_data) +static int find_current_ref(const char *refname, const unsigned char *sha1, + int flags, void *cb_data) { struct refmatch *info; @@ -427,7 +427,7 @@ info->first_ref = xstrdup(refname); return info->match; } -char *find_default_branch(struct cgit_repo *repo) +static char *find_default_branch(struct cgit_repo *repo) { struct refmatch info; char *ref; @@ -569,13 +569,13 @@ if (cmd->want_layout) 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); } -char *build_snapshot_setting(int bitmap) +static char *build_snapshot_setting(int bitmap) { const struct cgit_snapshot_format *f; char *result = xstrdup(""); @@ -595,7 +595,7 @@ result[len - 1] = '\0'; return result; } -char *get_first_line(char *txt) +static char *get_first_line(char *txt) { char *t = xstrdup(txt); char *p = strchr(t, '\n'); @@ -604,7 +604,7 @@ *p = '\0'; 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); @@ -649,7 +649,7 @@ cgit_find_stats_periodname(repo->max_stats)); 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 3fa217f921b56a670a7ddd4049cdb6180f68a1c7..d98989c4312aed59e9a6a45aee3b603c8ac1c48f 100644 --- a/configfile.c +++ b/configfile.c @@ -10,7 +10,7 @@ #include#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 @@ } return c; } -void skip_line(FILE *f) +static void skip_line(FILE *f) { int c; @@ -31,7 +31,7 @@ while ((c = next_char(f)) && c != '\n' && c != EOF) ; } -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 90cc1c0099198da575119e0b0f38fa3db478f785..b5c69034f5dfa8a07d9ccbf8a9c61194e9bd07d6 100644 --- a/html.c +++ b/html.c @@ -39,7 +39,7 @@ "%f4", "%f5", "%f6", "%f7", "%f8", "%f9", "%fa", "%fb", "%fc", "%fd", "%fe", "%ff" }; -int htmlfd = STDOUT_FILENO; +static int htmlfd = STDOUT_FILENO; char *fmt(const char *format, ...) { @@ -266,7 +266,7 @@ fclose(f); return 0; } -int hextoint(char c) +static int hextoint(char c) { if (c >= 'a' && c <= 'f') return 10 + c - 'a'; @@ -278,7 +278,7 @@ else return -1; } -char *convert_query_hexchar(char *txt) +static char *convert_query_hexchar(char *txt) { int d1, d2, n; n = strlen(txt); diff --git a/parsing.c b/parsing.c index 9b7efb31260658948bfae8374488bd673c815e16..658621d8e76b74336eb8827b3354d59ec9d35320 100644 --- a/parsing.c +++ b/parsing.c @@ -52,7 +52,7 @@ return; } } -char *substr(const char *head, const char *tail) +static char *substr(const char *head, const char *tail) { char *buf; @@ -64,7 +64,7 @@ buf[tail - head] = '\0'; return buf; } -char *parse_user(char *t, char **name, char **email, unsigned long *date) +static char *parse_user(char *t, char **name, char **email, unsigned long *date) { char *p = t; int mode = 1; @@ -101,7 +101,7 @@ #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 e732064afdb40b223dc21e73f25fe84a45a76127..124d079b05fc493811ef0d70eb6b6f4e1817c2d3 100644 --- a/shared.c +++ b/shared.c @@ -158,7 +158,7 @@ } list->refs[list->count++] = ref; } -struct refinfo *cgit_mk_refinfo(const char *refname, const unsigned char *sha1) +static struct refinfo *cgit_mk_refinfo(const char *refname, const unsigned char *sha1) { struct refinfo *ref; @@ -187,8 +187,8 @@ cgit_add_ref(list, info); return 0; } -void cgit_diff_tree_cb(struct diff_queue_struct *q, - struct diff_options *options, void *data) +static void cgit_diff_tree_cb(struct diff_queue_struct *q, + struct diff_options *options, void *data) { int i; @@ -224,7 +224,7 @@ */ 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; @@ -461,14 +461,14 @@ close(fd); return (*size == st.st_size ? 0 : e); } -int is_token_char(char c) +static int is_token_char(char c) { return isalnum(c) || c == '_'; } /* Replace name with getenv(name), return pointer to zero-terminating char */ -char *expand_macro(char *name, int maxlength) +static char *expand_macro(char *name, int maxlength) { char *value; int len; diff --git a/ui-atom.c b/ui-atom.c index b218456b6e0f4ddc3b57a42f6e542bec31b4be2b..5b5525d2976701f9a27343a244dcb6c3a1b07fa0 100644 --- a/ui-atom.c +++ b/ui-atom.c @@ -10,7 +10,7 @@ #include "cgit.h" #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-diff.c b/ui-diff.c index 49e5b468f4385605efed4cec567e3e016f501379..7de7802bad6e87f0553d2b4d81dd264d5a3ca8f9 100644 --- a/ui-diff.c +++ b/ui-diff.c @@ -166,8 +166,9 @@ total_adds += lines_added; total_rems += lines_removed; } -void cgit_print_diffstat(const unsigned char *old_sha1, - const unsigned char *new_sha1, const char *prefix) +static void cgit_print_diffstat(const unsigned char *old_sha1, + const unsigned char *new_sha1, + const char *prefix) { int i; diff --git a/ui-log.c b/ui-log.c index 2f41602a917de13ac9f9daa6cdd50ff15afa3c27..857c05c01f7a7ac26dd79078f9710ef7019ace7f 100644 --- a/ui-log.c +++ b/ui-log.c @@ -28,7 +28,7 @@ }; #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 @@ else if (line[0] == '-') 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 @@ deco = deco->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 1ae22aaa7e192e9b595118117f19c5f75f3e2219..66c88c4b639b68b95001d57cec234e83a41d0af0 100644 --- a/ui-repolist.c +++ b/ui-repolist.c @@ -12,7 +12,7 @@ #include "html.h" #include "ui-shared.h" #include <strings.h> -time_t read_agefile(char *path) +static time_t read_agefile(char *path) { time_t result; size_t size; @@ -76,7 +76,7 @@ if (get_repo_modtime(repo, &t)) 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; @@ -91,7 +91,7 @@ return 1; 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; @@ -100,7 +100,7 @@ return 1; 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) { @@ -110,7 +110,7 @@ } htmlf("'>%s</a></th>", title); } -void print_header() +static void print_header() { html("<tr class='nohover'>"); print_sort_header("Name", "name"); @@ -124,7 +124,7 @@ html("\n"); } -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, ofs; char *class = NULL; @@ -223,7 +223,7 @@ {"idle", sort_idle}, {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 af5310bb362e207a5970c61ec53716dac9ebd2c7..63a7116c4a60e1863e1667d239054e2e0c595256 100644 --- a/ui-shared.c +++ b/ui-shared.c @@ -121,7 +121,7 @@ return ++rv; return rvbuf; } -char *cgit_currurl() +static char *cgit_currurl() { if (!ctx.cfg.virtual_root) return ctx.cfg.script_name; @@ -433,8 +433,8 @@ { reporevlink("stats", name, title, class, head, NULL, path); } -void cgit_self_link(char *name, const char *title, const char *class, - struct cgit_context *ctx) +static void cgit_self_link(char *name, const char *title, const char *class, + struct cgit_context *ctx) { if (!strcmp(ctx->qry.page, "repolist")) return cgit_index_link(name, title, class, ctx->qry.search, ctx->qry.sort, @@ -512,8 +512,8 @@ name = fmt("%s %s...", typename(obj->type), shortrev); reporevlink(page, name, NULL, NULL, ctx.qry.head, fullrev, NULL); } -struct string_list_item *lookup_path(struct string_list *list, - const char *path) +static struct string_list_item *lookup_path(struct string_list *list, + const char *path) { struct string_list_item *item; @@ -716,16 +716,16 @@ html("