From bafab423f20bc1448b293842c235965e1681f07e Mon Sep 17 00:00:00 2001 From: Lukas Fleischer Date: Mon, 4 Mar 2013 08:52:33 +0100 Subject: Mark several functions/variables static Spotted by parsing the output of `gcc -Wmissing-prototypes [...]`. Signed-off-by: Lukas Fleischer --- ui-shared.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'ui-shared.c') diff --git a/ui-shared.c b/ui-shared.c index af5310b..63a7116 100644 --- a/ui-shared.c +++ b/ui-shared.c @@ -121,7 +121,7 @@ const char *cgit_repobasename(const char *reponame) return rvbuf; } -char *cgit_currurl() +static char *cgit_currurl() { if (!ctx.cfg.virtual_root) return ctx.cfg.script_name; @@ -433,8 +433,8 @@ void cgit_stats_link(const char *name, const char *title, const char *class, 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 @@ void cgit_object_link(struct object *obj) 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 @@ void cgit_print_docend() html("\n\n"); } -int print_branch_option(const char *refname, const unsigned char *sha1, - int flags, void *cb_data) +static int print_branch_option(const char *refname, const unsigned char *sha1, + int flags, void *cb_data) { char *name = (char *)refname; html_option(name, name, ctx.qry.head); return 0; } -int print_archive_ref(const char *refname, const unsigned char *sha1, - int flags, void *cb_data) +static int print_archive_ref(const char *refname, const unsigned char *sha1, + int flags, void *cb_data) { struct tag *tag; struct taginfo *info; -- cgit v1.2.3-70-g09d2 From 71926bfb342b75a6721441b1fe9b9db8b50775d5 Mon Sep 17 00:00:00 2001 From: Lukas Fleischer Date: Mon, 4 Mar 2013 08:52:34 +0100 Subject: ui-shared.c: Remove unused function cgit_currurl() This is no longer used as of commit 0c8e184e. Signed-off-by: Lukas Fleischer --- ui-shared.c | 12 ------------ 1 file changed, 12 deletions(-) (limited to 'ui-shared.c') diff --git a/ui-shared.c b/ui-shared.c index 63a7116..31224bc 100644 --- a/ui-shared.c +++ b/ui-shared.c @@ -121,18 +121,6 @@ const char *cgit_repobasename(const char *reponame) return rvbuf; } -static char *cgit_currurl() -{ - if (!ctx.cfg.virtual_root) - return ctx.cfg.script_name; - else if (ctx.qry.page) - return fmt("%s/%s/%s/", ctx.cfg.virtual_root, ctx.qry.repo, ctx.qry.page); - else if (ctx.qry.repo) - return fmt("%s/%s/", ctx.cfg.virtual_root, ctx.qry.repo); - else - return fmt("%s/", ctx.cfg.virtual_root); -} - static void site_url(const char *page, const char *search, const char *sort, int ofs) { char *delim = "?"; -- cgit v1.2.3-70-g09d2 From 1a5e8633ce3ec7f3a82bc0f4ca5ca810473714b9 Mon Sep 17 00:00:00 2001 From: Lukas Fleischer Date: Mon, 4 Mar 2013 08:52:35 +0100 Subject: ui-shared.c: Remove unused function print_archive_ref() This is no longer used as of commit f135569b. Signed-off-by: Lukas Fleischer --- ui-shared.c | 39 --------------------------------------- 1 file changed, 39 deletions(-) (limited to 'ui-shared.c') diff --git a/ui-shared.c b/ui-shared.c index 31224bc..77a302d 100644 --- a/ui-shared.c +++ b/ui-shared.c @@ -712,45 +712,6 @@ static int print_branch_option(const char *refname, const unsigned char *sha1, return 0; } -static int print_archive_ref(const char *refname, const unsigned char *sha1, - int flags, void *cb_data) -{ - struct tag *tag; - struct taginfo *info; - struct object *obj; - char buf[256], *url; - unsigned char fileid[20]; - int *header = (int *)cb_data; - - if (prefixcmp(refname, "refs/archives")) - return 0; - strncpy(buf, refname + 14, sizeof(buf)); - obj = parse_object(sha1); - if (!obj) - return 1; - if (obj->type == OBJ_TAG) { - tag = lookup_tag(sha1); - if (!tag || parse_tag(tag) || !(info = cgit_parse_tag(tag))) - return 0; - hashcpy(fileid, tag->tagged->sha1); - } else if (obj->type != OBJ_BLOB) { - return 0; - } else { - hashcpy(fileid, sha1); - } - if (!*header) { - html("

download

\n"); - *header = 1; - } - url = cgit_pageurl(ctx.qry.repo, "blob", - fmt("id=%s&path=%s", sha1_to_hex(fileid), - buf)); - html_link_open(url, NULL, "menu"); - html_txt(strlpart(buf, 20)); - html_link_close(); - return 0; -} - void cgit_add_hidden_formfields(int incl_head, int incl_search, const char *page) { -- cgit v1.2.3-70-g09d2 From 59fe348deaa270434f05afc56ca8d13618af9ca9 Mon Sep 17 00:00:00 2001 From: Lukas Fleischer Date: Mon, 4 Mar 2013 13:25:38 +0100 Subject: cgit_print_snapshot_links(): Free prefix variable Fixes following memory leak seen with "PATH_INFO=/cgit/commit/": ==16894== 12 bytes in 1 blocks are definitely lost in loss record 9 of 92 ==16894== at 0x4C2C04B: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==16894== by 0x56F2DF1: strdup (in /usr/lib/libc-2.17.so) ==16894== by 0x46CAC8: xstrdup (wrapper.c:35) ==16894== by 0x414E34: cgit_print_snapshot_links (ui-shared.c:926) ==16894== by 0x40CFA1: cgit_print_commit (ui-commit.c:102) ==16894== by 0x407B06: commit_fn (cmd.c:54) ==16894== by 0x405E16: process_request (cgit.c:574) ==16894== by 0x4074C8: cache_process (cache.c:322) ==16894== by 0x406C4F: main (cgit.c:872) Signed-off-by: Lukas Fleischer --- ui-shared.c | 1 + 1 file changed, 1 insertion(+) (limited to 'ui-shared.c') diff --git a/ui-shared.c b/ui-shared.c index 77a302d..d3e6488 100644 --- a/ui-shared.c +++ b/ui-shared.c @@ -931,4 +931,5 @@ void cgit_print_snapshot_links(const char *repo, const char *head, cgit_snapshot_link(filename, NULL, NULL, NULL, NULL, filename); html("
"); } + free(prefix); } -- cgit v1.2.3-70-g09d2