From f2382990742bff816ec54883e6204ededc378e7f Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Thu, 6 Aug 2026 21:09:57 -1000 Subject: Settle the names, types and layout of the sources --- source/ui-stats.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'source/ui-stats.c') diff --git a/source/ui-stats.c b/source/ui-stats.c index 3ae3034..4c83cf3 100644 --- a/source/ui-stats.c +++ b/source/ui-stats.c @@ -79,7 +79,7 @@ static char *pretty_month(struct tm *tm) "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; - return fmt("%s %d", months[tm->tm_mon], tm->tm_year + 1900); + return cgit_fmt("%s %d", months[tm->tm_mon], tm->tm_year + 1900); } static void trunc_quarter(struct tm *tm) @@ -105,7 +105,7 @@ static void inc_quarter(struct tm *tm) static char *pretty_quarter(struct tm *tm) { - return fmt("Q%d %d", tm->tm_mon / 3 + 1, tm->tm_year + 1900); + return cgit_fmt("Q%d %d", tm->tm_mon / 3 + 1, tm->tm_year + 1900); } static void trunc_year(struct tm *tm) @@ -126,7 +126,7 @@ static void inc_year(struct tm *tm) static char *pretty_year(struct tm *tm) { - return fmt("%d", tm->tm_year + 1900); + return cgit_fmt("%d", tm->tm_year + 1900); } static const struct cgit_period periods[] = { @@ -142,7 +142,7 @@ static const struct cgit_period periods[] = { */ int cgit_find_stats_period(const char *expr, const struct cgit_period **period) { - int i; + size_t i; char code = '\0'; if (!expr) @@ -151,7 +151,7 @@ int cgit_find_stats_period(const char *expr, const struct cgit_period **period) if (strlen(expr) == 1) code = expr[0]; - for (i = 0; i < sizeof(periods) / sizeof(periods[0]); i++) + for (i = 0; i < ARRAY_SIZE(periods); i++) if (periods[i].code == code || !strcmp(periods[i].name, expr)) { if (period) *period = &periods[i]; @@ -259,7 +259,7 @@ static struct string_list collect_stats(const struct cgit_period *period) while ((commit = get_revision(&rev)) != NULL) { struct commitinfo *info = cgit_parse_commit(commit); - if (info->committer_date >= since) + if ((time_t)info->committer_date >= since) add_commit(&authors, info, period); cgit_free_commitinfo(info); @@ -293,7 +293,7 @@ static void print_combined_authorrow(struct string_list *authors, int from, total = 0; htmlf("%s", leftclass, - fmt(name, to - from + 1)); + cgit_fmt(name, to - from + 1)); for (j = 0; j < period->count; j++) { tmp = period->pretty(&tm); period->inc(&tm); @@ -484,7 +484,8 @@ static void print_language_row(const char *label, unsigned long bytes, static void print_languages(struct lang_walk_ctx *lw) { unsigned long other; - int i, shown; + size_t i; + int shown; if (!lw->total) return; @@ -574,8 +575,8 @@ void cgit_show_stats(void) html("Period:"); html(""); } html("Authors:"); -- cgit v2.8.0