aboutsummaryrefslogtreecommitdiffstats
path: root/ui-shared.c
diff options
context:
space:
mode:
authorGravatar John Keeping <john@keeping.me.uk>2013-03-07 05:51:54 (JST)
committerGravatar Jason A. Donenfeld <Jason@zx2c4.com>2013-03-21 04:21:17 (JST)
commit6d8a789d61f3a682bc040f1f7f44050b1f723546 (patch)
tree2cfcfee69d573bd837638bcbde318514a3621876 /ui-shared.c
parentd5a43b429a4248a02e3a403f76fff0cbae92ef32 (diff)
downloadcgit-6d8a789d61f3a682bc040f1f7f44050b1f723546.zip
cgit-6d8a789d61f3a682bc040f1f7f44050b1f723546.tar.gz
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>
Diffstat (limited to 'ui-shared.c')
-rw-r--r--ui-shared.c83
1 files changed, 42 insertions, 41 deletions
diff --git a/ui-shared.c b/ui-shared.c
index af5310b..80f4aee 100644
--- a/ui-shared.c
+++ b/ui-shared.c
@@ -437,58 +437,59 @@ void cgit_self_link(char *name, const char *title, const char *class,
437 struct cgit_context *ctx) 437 struct cgit_context *ctx)
438{ 438{
439 if (!strcmp(ctx->qry.page, "repolist")) 439 if (!strcmp(ctx->qry.page, "repolist"))
440 return cgit_index_link(name, title, class, ctx->qry.search, ctx->qry.sort, 440 cgit_index_link(name, title, class, ctx->qry.search, ctx->qry.sort,
441 ctx->qry.ofs); 441 ctx->qry.ofs);
442 else if (!strcmp(ctx->qry.page, "summary")) 442 else if (!strcmp(ctx->qry.page, "summary"))
443 return cgit_summary_link(name, title, class, ctx->qry.head); 443 cgit_summary_link(name, title, class, ctx->qry.head);
444 else if (!strcmp(ctx->qry.page, "tag")) 444 else if (!strcmp(ctx->qry.page, "tag"))
445 return cgit_tag_link(name, title, class, ctx->qry.head, 445 cgit_tag_link(name, title, class, ctx->qry.head,
446 ctx->qry.has_sha1 ? ctx->qry.sha1 : NULL); 446 ctx->qry.has_sha1 ? ctx->qry.sha1 : NULL);
447 else if (!strcmp(ctx->qry.page, "tree")) 447 else if (!strcmp(ctx->qry.page, "tree"))
448 return cgit_tree_link(name, title, class, ctx->qry.head, 448 cgit_tree_link(name, title, class, ctx->qry.head,
449 ctx->qry.has_sha1 ? ctx->qry.sha1 : NULL, 449 ctx->qry.has_sha1 ? ctx->qry.sha1 : NULL,
450 ctx->qry.path); 450 ctx->qry.path);
451 else if (!strcmp(ctx->qry.page, "plain")) 451 else if (!strcmp(ctx->qry.page, "plain"))
452 return cgit_plain_link(name, title, class, ctx->qry.head, 452 cgit_plain_link(name, title, class, ctx->qry.head,
453 ctx->qry.has_sha1 ? ctx->qry.sha1 : NULL, 453 ctx->qry.has_sha1 ? ctx->qry.sha1 : NULL,
454 ctx->qry.path); 454 ctx->qry.path);
455 else if (!strcmp(ctx->qry.page, "log")) 455 else if (!strcmp(ctx->qry.page, "log"))
456 return cgit_log_link(name, title, class, ctx->qry.head, 456 cgit_log_link(name, title, class, ctx->qry.head,
457 ctx->qry.has_sha1 ? ctx->qry.sha1 : NULL, 457 ctx->qry.has_sha1 ? ctx->qry.sha1 : NULL,
458 ctx->qry.path, ctx->qry.ofs, 458 ctx->qry.path, ctx->qry.ofs,
459 ctx->qry.grep, ctx->qry.search, 459 ctx->qry.grep, ctx->qry.search,
460 ctx->qry.showmsg); 460 ctx->qry.showmsg);
461 else if (!strcmp(ctx->qry.page, "commit")) 461 else if (!strcmp(ctx->qry.page, "commit"))
462 return cgit_commit_link(name, title, class, ctx->qry.head, 462 cgit_commit_link(name, title, class, ctx->qry.head,
463 ctx->qry.has_sha1 ? ctx->qry.sha1 : NULL, 463 ctx->qry.has_sha1 ? ctx->qry.sha1 : NULL,
464 ctx->qry.path, 0); 464 ctx->qry.path, 0);
465 else if (!strcmp(ctx->qry.page, "patch")) 465 else if (!strcmp(ctx->qry.page, "patch"))
466 return cgit_patch_link(name, title, class, ctx->qry.head, 466 cgit_patch_link(name, title, class, ctx->qry.head,
467 ctx->qry.has_sha1 ? ctx->qry.sha1 : NULL, 467 ctx->qry.has_sha1 ? ctx->qry.sha1 : NULL,
468 ctx->qry.path); 468 ctx->qry.path);
469 else if (!strcmp(ctx->qry.page, "refs")) 469 else if (!strcmp(ctx->qry.page, "refs"))
470 return cgit_refs_link(name, title, class, ctx->qry.head, 470 cgit_refs_link(name, title, class, ctx->qry.head,
471 ctx->qry.has_sha1 ? ctx->qry.sha1 : NULL, 471 ctx->qry.has_sha1 ? ctx->qry.sha1 : NULL,
472 ctx->qry.path); 472 ctx->qry.path);
473 else if (!strcmp(ctx->qry.page, "snapshot")) 473 else if (!strcmp(ctx->qry.page, "snapshot"))
474 return cgit_snapshot_link(name, title, class, ctx->qry.head, 474 cgit_snapshot_link(name, title, class, ctx->qry.head,
475 ctx->qry.has_sha1 ? ctx->qry.sha1 : NULL, 475 ctx->qry.has_sha1 ? ctx->qry.sha1 : NULL,
476 ctx->qry.path); 476 ctx->qry.path);
477 else if (!strcmp(ctx->qry.page, "diff")) 477 else if (!strcmp(ctx->qry.page, "diff"))
478 return cgit_diff_link(name, title, class, ctx->qry.head, 478 cgit_diff_link(name, title, class, ctx->qry.head,
479 ctx->qry.sha1, ctx->qry.sha2, 479 ctx->qry.sha1, ctx->qry.sha2,
480 ctx->qry.path, 0); 480 ctx->qry.path, 0);
481 else if (!strcmp(ctx->qry.page, "stats")) 481 else if (!strcmp(ctx->qry.page, "stats"))
482 return cgit_stats_link(name, title, class, ctx->qry.head, 482 cgit_stats_link(name, title, class, ctx->qry.head,
483 ctx->qry.path); 483 ctx->qry.path);
484 484 else {
485 /* Don't known how to make link for this page */ 485 /* Don't known how to make link for this page */
486 repolink(title, class, ctx->qry.page, ctx->qry.head, ctx->qry.path); 486 repolink(title, class, ctx->qry.page, ctx->qry.head, ctx->qry.path);
487 html("><!-- cgit_self_link() doesn't know how to make link for page '"); 487 html("><!-- cgit_self_link() doesn't know how to make link for page '");
488 html_txt(ctx->qry.page); 488 html_txt(ctx->qry.page);
489 html("' -->"); 489 html("' -->");
490 html_txt(name); 490 html_txt(name);
491 html("</a>"); 491 html("</a>");
492 }
492} 493}
493 494
494void cgit_object_link(struct object *obj) 495void cgit_object_link(struct object *obj)