Diff options
| author | Bryce Kwon <bryce@brycekwon.com> | |
|---|---|---|
| committer | Bryce Kwon <bryce@brycekwon.com> | |
| commit | ||
| parent | ||
| tree | ||
| download | ||
Keep three helpers beside their only callers
Diffstat (limited to 'source/ui-shared.c')
| -rw-r--r-- | source/ui-shared.c | 124 |
1 file changed, 62 insertions, 62 deletions
diff --git a/source/ui-shared.c b/source/ui-shared.c index 6c1b85e..7049f70 100644 --- a/source/ui-shared.c +++ b/source/ui-shared.c @@ -187,51 +187,6 @@ static void emit_diff_args(const char *delim) } } -static struct string_list_item *lookup_path(struct string_list *list, const char *path) -{ - struct string_list_item *item; - - while (path && path[0]) { - if ((item = string_list_lookup(list, path))) - return item; - if (!(path = strchr(path, '/'))) - break; - path++; - } - return NULL; -} - -/* - * A repository can supply the module-link template through a repo-local - * cgitrc, so the %s placeholders are expanded here instead of the template - * being handed to printf, where a surplus conversion would read past the - * argument list. - */ -static void emit_module_link(const char *tmpl, const char **args, int nargs) -{ - struct strbuf sb = STRBUF_INIT; - int used = 0; - - while (*tmpl) { - if (*tmpl != '%') { - strbuf_addch(&sb, *tmpl++); - continue; - } - tmpl++; - if (*tmpl == '%') { - strbuf_addch(&sb, '%'); - tmpl++; - } else if (*tmpl == 's' && used < nargs) { - strbuf_addstr(&sb, args[used++]); - tmpl++; - } else { - strbuf_addch(&sb, '%'); - } - } - html_attr(sb.buf); - strbuf_release(&sb); -} - static struct date_mode configured_date_mode(void) { struct date_mode mode = ctx.cfg.date_mode; @@ -315,23 +270,6 @@ static void emit_js_link(const char *src) html("' defer></script>\n"); } -static void add_clone_urls(void (*fn)(const char *), char *urls, char *suffix) -{ - struct strbuf **url_list = strbuf_split_str(urls, ' ', 0); - int i; - - for (i = 0; url_list[i]; i++) { - strbuf_rtrim(url_list[i]); - if (url_list[i]->len == 0) - continue; - if (suffix && *suffix) - strbuf_addf(url_list[i], "/%s", suffix); - fn(url_list[i]->buf); - } - - strbuf_list_free(url_list); -} - /* * The id parameter pins a page to one commit while the rest of the chrome * keeps naming the branch. Answer that commit, or null when the request @@ -1200,6 +1138,51 @@ static void gitmodules_link(const char *path, const char *rev, char **module, *tooltip = url; } +static struct string_list_item *lookup_path(struct string_list *list, const char *path) +{ + struct string_list_item *item; + + while (path && path[0]) { + if ((item = string_list_lookup(list, path))) + return item; + if (!(path = strchr(path, '/'))) + break; + path++; + } + return NULL; +} + +/* + * A repository can supply the module-link template through a repo-local + * cgitrc, so the %s placeholders are expanded here instead of the template + * being handed to printf, where a surplus conversion would read past the + * argument list. + */ +static void emit_module_link(const char *tmpl, const char **args, int nargs) +{ + struct strbuf sb = STRBUF_INIT; + int used = 0; + + while (*tmpl) { + if (*tmpl != '%') { + strbuf_addch(&sb, *tmpl++); + continue; + } + tmpl++; + if (*tmpl == '%') { + strbuf_addch(&sb, '%'); + tmpl++; + } else if (*tmpl == 's' && used < nargs) { + strbuf_addstr(&sb, args[used++]); + tmpl++; + } else { + strbuf_addch(&sb, '%'); + } + } + html_attr(sb.buf); + strbuf_release(&sb); +} + void cgit_submodule_link(const char *class, char *path, const char *rev) { struct string_list *list; @@ -1550,6 +1533,23 @@ void cgit_print_layout_end(void) cgit_print_docend(); } +static void add_clone_urls(void (*fn)(const char *), char *urls, char *suffix) +{ + struct strbuf **url_list = strbuf_split_str(urls, ' ', 0); + int i; + + for (i = 0; url_list[i]; i++) { + strbuf_rtrim(url_list[i]); + if (url_list[i]->len == 0) + continue; + if (suffix && *suffix) + strbuf_addf(url_list[i], "/%s", suffix); + fn(url_list[i]->buf); + } + + strbuf_list_free(url_list); +} + void cgit_add_clone_urls(void (*fn)(const char *)) { if (ctx.repo->clone_url) |
