From: john at keeping.me.uk (John Keeping)
Subject: [PATCH 1/2] ui-shared: fix decl-after-statement warnings
Date: Sun, 7 Aug 2016 16:15:13 +0100 [thread overview]
Message-ID: <574d5e8f840cd33eb54fba3f0b973561b0bcdb94.1470582914.git.john@keeping.me.uk> (raw)
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 at keeping.me.uk>
---
ui-shared.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/ui-shared.c b/ui-shared.c
index e39d004..3fa36d6 100644
--- a/ui-shared.c
+++ b/ui-shared.c
@@ -66,10 +66,11 @@ char *cgit_hosturl(void)
char *cgit_currenturl(void)
{
- if (!ctx.qry.url)
- return xstrdup(cgit_rooturl());
const char *root = cgit_rooturl();
size_t len = strlen(root);
+
+ if (!ctx.qry.url)
+ return xstrdup(root);
if (len && root[len - 1] == '/')
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,
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) {
name[ctx.cfg.max_msg_len] = '\0';
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] = '.';
}
- char *delim;
-
delim = repolink(title, class, "commit", head, path);
if (rev && ctx.qry.head && strcmp(rev, ctx.qry.head)) {
html(delim);
@@ -714,13 +715,14 @@ static void print_rel_vcs_link(const char *url)
void cgit_print_docstart(void)
{
+ char *host = cgit_hosturl();
+
if (ctx.cfg.embedded) {
if (ctx.cfg.header)
html_include(ctx.cfg.header);
return;
}
- char *host = cgit_hosturl();
html(cgit_doctype);
html("<html lang='en'>\n");
html("<head>\n");
--
2.9.2.639.g855ae9f
next reply other threads:[~2016-08-07 15:15 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-07 15:15 john [this message]
2016-08-07 15:15 ` [PATCH 2/2] ui-ssdiff: " john
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=574d5e8f840cd33eb54fba3f0b973561b0bcdb94.1470582914.git.john@keeping.me.uk \
--to=cgit@lists.zx2c4.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).