mirror of
https://git.zx2c4.com/cgit
synced 2024-11-22 16:38:42 +00:00
ui-shared: fix return type of cgit_self_link
cgit_self_link() is a void function but implements each case it handles by doing "return <another_void_function>" which is not valid C; section 6.8.6.4 of C11 says: A return statement with an expression shall not appear in a function whose return type is void. Fix this by removing the return keywords and converting the final code block into an "else". Signed-off-by: John Keeping <john@keeping.me.uk>
This commit is contained in:
parent
d5a43b429a
commit
6d8a789d61
83
ui-shared.c
83
ui-shared.c
@ -437,58 +437,59 @@ void cgit_self_link(char *name, const char *title, const char *class,
|
|||||||
struct cgit_context *ctx)
|
struct cgit_context *ctx)
|
||||||
{
|
{
|
||||||
if (!strcmp(ctx->qry.page, "repolist"))
|
if (!strcmp(ctx->qry.page, "repolist"))
|
||||||
return cgit_index_link(name, title, class, ctx->qry.search, ctx->qry.sort,
|
cgit_index_link(name, title, class, ctx->qry.search, ctx->qry.sort,
|
||||||
ctx->qry.ofs);
|
ctx->qry.ofs);
|
||||||
else if (!strcmp(ctx->qry.page, "summary"))
|
else if (!strcmp(ctx->qry.page, "summary"))
|
||||||
return cgit_summary_link(name, title, class, ctx->qry.head);
|
cgit_summary_link(name, title, class, ctx->qry.head);
|
||||||
else if (!strcmp(ctx->qry.page, "tag"))
|
else if (!strcmp(ctx->qry.page, "tag"))
|
||||||
return cgit_tag_link(name, title, class, ctx->qry.head,
|
cgit_tag_link(name, title, class, ctx->qry.head,
|
||||||
ctx->qry.has_sha1 ? ctx->qry.sha1 : NULL);
|
ctx->qry.has_sha1 ? ctx->qry.sha1 : NULL);
|
||||||
else if (!strcmp(ctx->qry.page, "tree"))
|
else if (!strcmp(ctx->qry.page, "tree"))
|
||||||
return cgit_tree_link(name, title, class, ctx->qry.head,
|
cgit_tree_link(name, title, class, ctx->qry.head,
|
||||||
ctx->qry.has_sha1 ? ctx->qry.sha1 : NULL,
|
ctx->qry.has_sha1 ? ctx->qry.sha1 : NULL,
|
||||||
ctx->qry.path);
|
ctx->qry.path);
|
||||||
else if (!strcmp(ctx->qry.page, "plain"))
|
else if (!strcmp(ctx->qry.page, "plain"))
|
||||||
return cgit_plain_link(name, title, class, ctx->qry.head,
|
cgit_plain_link(name, title, class, ctx->qry.head,
|
||||||
ctx->qry.has_sha1 ? ctx->qry.sha1 : NULL,
|
ctx->qry.has_sha1 ? ctx->qry.sha1 : NULL,
|
||||||
ctx->qry.path);
|
ctx->qry.path);
|
||||||
else if (!strcmp(ctx->qry.page, "log"))
|
else if (!strcmp(ctx->qry.page, "log"))
|
||||||
return cgit_log_link(name, title, class, ctx->qry.head,
|
cgit_log_link(name, title, class, ctx->qry.head,
|
||||||
ctx->qry.has_sha1 ? ctx->qry.sha1 : NULL,
|
ctx->qry.has_sha1 ? ctx->qry.sha1 : NULL,
|
||||||
ctx->qry.path, ctx->qry.ofs,
|
ctx->qry.path, ctx->qry.ofs,
|
||||||
ctx->qry.grep, ctx->qry.search,
|
ctx->qry.grep, ctx->qry.search,
|
||||||
ctx->qry.showmsg);
|
ctx->qry.showmsg);
|
||||||
else if (!strcmp(ctx->qry.page, "commit"))
|
else if (!strcmp(ctx->qry.page, "commit"))
|
||||||
return cgit_commit_link(name, title, class, ctx->qry.head,
|
cgit_commit_link(name, title, class, ctx->qry.head,
|
||||||
ctx->qry.has_sha1 ? ctx->qry.sha1 : NULL,
|
ctx->qry.has_sha1 ? ctx->qry.sha1 : NULL,
|
||||||
ctx->qry.path, 0);
|
ctx->qry.path, 0);
|
||||||
else if (!strcmp(ctx->qry.page, "patch"))
|
else if (!strcmp(ctx->qry.page, "patch"))
|
||||||
return cgit_patch_link(name, title, class, ctx->qry.head,
|
cgit_patch_link(name, title, class, ctx->qry.head,
|
||||||
ctx->qry.has_sha1 ? ctx->qry.sha1 : NULL,
|
ctx->qry.has_sha1 ? ctx->qry.sha1 : NULL,
|
||||||
ctx->qry.path);
|
ctx->qry.path);
|
||||||
else if (!strcmp(ctx->qry.page, "refs"))
|
else if (!strcmp(ctx->qry.page, "refs"))
|
||||||
return cgit_refs_link(name, title, class, ctx->qry.head,
|
cgit_refs_link(name, title, class, ctx->qry.head,
|
||||||
ctx->qry.has_sha1 ? ctx->qry.sha1 : NULL,
|
ctx->qry.has_sha1 ? ctx->qry.sha1 : NULL,
|
||||||
ctx->qry.path);
|
ctx->qry.path);
|
||||||
else if (!strcmp(ctx->qry.page, "snapshot"))
|
else if (!strcmp(ctx->qry.page, "snapshot"))
|
||||||
return cgit_snapshot_link(name, title, class, ctx->qry.head,
|
cgit_snapshot_link(name, title, class, ctx->qry.head,
|
||||||
ctx->qry.has_sha1 ? ctx->qry.sha1 : NULL,
|
ctx->qry.has_sha1 ? ctx->qry.sha1 : NULL,
|
||||||
ctx->qry.path);
|
ctx->qry.path);
|
||||||
else if (!strcmp(ctx->qry.page, "diff"))
|
else if (!strcmp(ctx->qry.page, "diff"))
|
||||||
return cgit_diff_link(name, title, class, ctx->qry.head,
|
cgit_diff_link(name, title, class, ctx->qry.head,
|
||||||
ctx->qry.sha1, ctx->qry.sha2,
|
ctx->qry.sha1, ctx->qry.sha2,
|
||||||
ctx->qry.path, 0);
|
ctx->qry.path, 0);
|
||||||
else if (!strcmp(ctx->qry.page, "stats"))
|
else if (!strcmp(ctx->qry.page, "stats"))
|
||||||
return cgit_stats_link(name, title, class, ctx->qry.head,
|
cgit_stats_link(name, title, class, ctx->qry.head,
|
||||||
ctx->qry.path);
|
ctx->qry.path);
|
||||||
|
else {
|
||||||
/* Don't known how to make link for this page */
|
/* Don't known how to make link for this page */
|
||||||
repolink(title, class, ctx->qry.page, ctx->qry.head, ctx->qry.path);
|
repolink(title, class, ctx->qry.page, ctx->qry.head, ctx->qry.path);
|
||||||
html("><!-- cgit_self_link() doesn't know how to make link for page '");
|
html("><!-- cgit_self_link() doesn't know how to make link for page '");
|
||||||
html_txt(ctx->qry.page);
|
html_txt(ctx->qry.page);
|
||||||
html("' -->");
|
html("' -->");
|
||||||
html_txt(name);
|
html_txt(name);
|
||||||
html("</a>");
|
html("</a>");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void cgit_object_link(struct object *obj)
|
void cgit_object_link(struct object *obj)
|
||||||
|
Loading…
Reference in New Issue
Block a user