mirror of
https://git.zx2c4.com/cgit
synced 2024-11-22 08:28:42 +00:00
ui-shared: fix decl-after-statement warnings
git.git's coding style avoids decl-after-statement and we generally try to follow it but a few warnings have crept in recently. Fix the ones in ui-shared.c Signed-off-by: John Keeping <john@keeping.me.uk>
This commit is contained in:
parent
35df710a1f
commit
bead27b730
12
ui-shared.c
12
ui-shared.c
@ -66,10 +66,11 @@ char *cgit_hosturl(void)
|
|||||||
|
|
||||||
char *cgit_currenturl(void)
|
char *cgit_currenturl(void)
|
||||||
{
|
{
|
||||||
if (!ctx.qry.url)
|
|
||||||
return xstrdup(cgit_rooturl());
|
|
||||||
const char *root = cgit_rooturl();
|
const char *root = cgit_rooturl();
|
||||||
size_t len = strlen(root);
|
size_t len = strlen(root);
|
||||||
|
|
||||||
|
if (!ctx.qry.url)
|
||||||
|
return xstrdup(root);
|
||||||
if (len && root[len - 1] == '/')
|
if (len && root[len - 1] == '/')
|
||||||
return fmtalloc("%s%s", root, ctx.qry.url);
|
return fmtalloc("%s%s", root, ctx.qry.url);
|
||||||
return fmtalloc("%s/%s", root, ctx.qry.url);
|
return fmtalloc("%s/%s", root, ctx.qry.url);
|
||||||
@ -349,6 +350,8 @@ void cgit_log_link(const char *name, const char *title, const char *class,
|
|||||||
void cgit_commit_link(char *name, const char *title, const char *class,
|
void cgit_commit_link(char *name, const char *title, const char *class,
|
||||||
const char *head, const char *rev, const char *path)
|
const char *head, const char *rev, const char *path)
|
||||||
{
|
{
|
||||||
|
char *delim;
|
||||||
|
|
||||||
if (strlen(name) > ctx.cfg.max_msg_len && ctx.cfg.max_msg_len >= 15) {
|
if (strlen(name) > ctx.cfg.max_msg_len && ctx.cfg.max_msg_len >= 15) {
|
||||||
name[ctx.cfg.max_msg_len] = '\0';
|
name[ctx.cfg.max_msg_len] = '\0';
|
||||||
name[ctx.cfg.max_msg_len - 1] = '.';
|
name[ctx.cfg.max_msg_len - 1] = '.';
|
||||||
@ -356,8 +359,6 @@ void cgit_commit_link(char *name, const char *title, const char *class,
|
|||||||
name[ctx.cfg.max_msg_len - 3] = '.';
|
name[ctx.cfg.max_msg_len - 3] = '.';
|
||||||
}
|
}
|
||||||
|
|
||||||
char *delim;
|
|
||||||
|
|
||||||
delim = repolink(title, class, "commit", head, path);
|
delim = repolink(title, class, "commit", head, path);
|
||||||
if (rev && ctx.qry.head && strcmp(rev, ctx.qry.head)) {
|
if (rev && ctx.qry.head && strcmp(rev, ctx.qry.head)) {
|
||||||
html(delim);
|
html(delim);
|
||||||
@ -714,13 +715,14 @@ static void print_rel_vcs_link(const char *url)
|
|||||||
|
|
||||||
void cgit_print_docstart(void)
|
void cgit_print_docstart(void)
|
||||||
{
|
{
|
||||||
|
char *host = cgit_hosturl();
|
||||||
|
|
||||||
if (ctx.cfg.embedded) {
|
if (ctx.cfg.embedded) {
|
||||||
if (ctx.cfg.header)
|
if (ctx.cfg.header)
|
||||||
html_include(ctx.cfg.header);
|
html_include(ctx.cfg.header);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *host = cgit_hosturl();
|
|
||||||
html(cgit_doctype);
|
html(cgit_doctype);
|
||||||
html("<html lang='en'>\n");
|
html("<html lang='en'>\n");
|
||||||
html("<head>\n");
|
html("<head>\n");
|
||||||
|
Loading…
Reference in New Issue
Block a user