summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukas Fleischer <cgit@cryptocrack.de>2013-03-05 16:48:27 +0100
committerJason A. Donenfeld <Jason@zx2c4.com>2013-03-20 21:08:32 +0100
commit977a3ad7bf212e6ec7f43c16763321061ee64a69 (patch)
tree49b80b6cac3e0d66e7ff73ef45d42f66ac8c5859
parentef8a97d9c6983e4fc3710bdbe771edd4e3550dba (diff)
downloadcgit-977a3ad7bf212e6ec7f43c16763321061ee64a69.tar.gz
cgit-977a3ad7bf212e6ec7f43c16763321061ee64a69.tar.bz2
ui-summary.c: Move urls variable into print_urls()
There's no need for this variable to be global. Printing the header in print_urls() instead of print_url() allows for moving this variable into print_urls() without having to pass any status to print_url(). Note that this only works as long as we don't call print_urls() more than once. Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
-rw-r--r--ui-summary.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/ui-summary.c b/ui-summary.c
index 38639ce..0754bb7 100644
--- a/ui-summary.c
+++ b/ui-summary.c
@@ -13,8 +13,6 @@
#include "ui-refs.h"
#include "ui-blob.h"
-int urls = 0;
-
static void print_url(char *base, char *suffix)
{
int columns = 3;
@@ -26,10 +24,6 @@ static void print_url(char *base, char *suffix)
if (!base || !*base)
return;
- if (urls++ == 0) {
- htmlf("<tr class='nohover'><td colspan='%d'>&nbsp;</td></tr>", columns);
- htmlf("<tr><th class='left' colspan='%d'>Clone</th></tr>\n", columns);
- }
if (suffix && *suffix)
base = fmt("%s/%s", base, suffix);
htmlf("<tr><td colspan='%d'><a href='", columns);
@@ -42,15 +36,29 @@ static void print_url(char *base, char *suffix)
static void print_urls(char *txt, char *suffix)
{
char *h = txt, *t, c;
+ int urls = 0;
+ int columns = 3;
+
+ if (ctx.repo->enable_log_filecount)
+ columns++;
+ if (ctx.repo->enable_log_linecount)
+ columns++;
+
while (h && *h) {
while (h && *h == ' ')
h++;
+ if (!*h)
+ break;
t = h;
while (t && *t && *t != ' ')
t++;
c = *t;
*t = 0;
+ if (urls++ == 0) {
+ htmlf("<tr class='nohover'><td colspan='%d'>&nbsp;</td></tr>", columns);
+ htmlf("<tr><th class='left' colspan='%d'>Clone</th></tr>\n", columns);
+ }
print_url(h, suffix);
*t = c;
h = t;