about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--ui-stats.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/ui-stats.c b/ui-stats.c index 74ce0f7..a9c13fd 100644 --- a/ui-stats.c +++ b/ui-stats.c
@@ -3,12 +3,6 @@
3#include "html.h" 3#include "html.h"
4#include "ui-shared.h" 4#include "ui-shared.h"
5 5
6#ifdef NO_C99_FORMAT
7#define SZ_FMT "%u"
8#else
9#define SZ_FMT "%zu"
10#endif
11
12struct authorstat { 6struct authorstat {
13 long total; 7 long total;
14 struct string_list list; 8 struct string_list list;
@@ -174,6 +168,7 @@ static void add_commit(struct string_list *authors, struct commit *commit,
174 char *tmp; 168 char *tmp;
175 struct tm *date; 169 struct tm *date;
176 time_t t; 170 time_t t;
171 uintptr_t *counter;
177 172
178 info = cgit_parse_commit(commit); 173 info = cgit_parse_commit(commit);
179 tmp = xstrdup(info->author); 174 tmp = xstrdup(info->author);
@@ -191,7 +186,9 @@ static void add_commit(struct string_list *authors, struct commit *commit,
191 item = string_list_insert(items, tmp); 186 item = string_list_insert(items, tmp);
192 if (item->util) 187 if (item->util)
193 free(tmp); 188 free(tmp);
194 item->util++; 189 counter = (uintptr_t *)&item->util;
190 (*counter)++;
191
195 authorstat->total++; 192 authorstat->total++;
196 cgit_free_commitinfo(info); 193 cgit_free_commitinfo(info);
197} 194}
@@ -286,7 +283,7 @@ static void print_combined_authorrow(struct string_list *authors, int from,
286 items = &authorstat->list; 283 items = &authorstat->list;
287 date = string_list_lookup(items, tmp); 284 date = string_list_lookup(items, tmp);
288 if (date) 285 if (date)
289 subtotal += (size_t)date->util; 286 subtotal += (uintptr_t)date->util;
290 } 287 }
291 htmlf("<td class='%s'>%ld</td>", centerclass, subtotal); 288 htmlf("<td class='%s'>%ld</td>", centerclass, subtotal);
292 total += subtotal; 289 total += subtotal;
@@ -340,8 +337,8 @@ static void print_authors(struct string_list *authors, int top,
340 if (!date) 337 if (!date)
341 html("<td>0</td>"); 338 html("<td>0</td>");
342 else { 339 else {
343 htmlf("<td>"SZ_FMT"</td>", (size_t)date->util); 340 htmlf("<td>%lu</td>", (uintptr_t)date->util);
344 total += (size_t)date->util; 341 total += (uintptr_t)date->util;
345 } 342 }
346 } 343 }
347 htmlf("<td class='sum'>%ld</td></tr>", total); 344 htmlf("<td class='sum'>%ld</td></tr>", total);