From d8a045c91469b1d121b8fd14dffaa367b194831d Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Sun, 6 Sep 2026 21:46:52 -1000 Subject: Clean up the whole tree --- source/ui-stats.c | 38 +++++++++++++------------------------- 1 file changed, 13 insertions(+), 25 deletions(-) (limited to 'source/ui-stats.c') diff --git a/source/ui-stats.c b/source/ui-stats.c index 62aac56..a04b189 100644 --- a/source/ui-stats.c +++ b/source/ui-stats.c @@ -168,7 +168,7 @@ static void window_start(const struct cgit_period *period, struct tm *tm) } static void add_commit(struct string_list *authors, struct commitinfo *info, - const struct cgit_period *period) + const struct cgit_period *period) { struct string_list_item *author, *bucket; struct authorstat *stats; @@ -296,11 +296,9 @@ static struct string_list build_period_labels(const struct cgit_period *period) * The run of authors to sum is given as a start and a count rather than as * two indices, so that an empty author list cannot describe a run that wraps. */ -static void print_summary_row(struct string_list *authors, size_t from, - size_t count, const char *label_format, - const char *leftclass, const char *centerclass, - const char *rightclass, - const struct string_list *labels) +static void print_summary_row(struct string_list *authors, size_t from, size_t count, + const char *label_format, const char *leftclass, const char *centerclass, + const char *rightclass, const struct string_list *labels) { struct authorstat *stats; struct string_list_item *bucket; @@ -308,8 +306,7 @@ static void print_summary_row(struct string_list *authors, size_t from, long total, subtotal; total = 0; - htmlf("%s", leftclass, - cgit_fmt(label_format, (long)count)); + htmlf("%s", leftclass, cgit_fmt(label_format, (long)count)); for (column = 0; column < labels->nr; column++) { const char *label = labels->items[column].string; @@ -326,8 +323,7 @@ static void print_summary_row(struct string_list *authors, size_t from, htmlf("%ld\n", rightclass, total); } -static void print_authors(struct string_list *authors, int max_rows, - const struct string_list *labels) +static void print_authors(struct string_list *authors, int max_rows, const struct string_list *labels) { struct string_list_item *author, *bucket; struct authorstat *stats; @@ -340,8 +336,7 @@ static void print_authors(struct string_list *authors, int max_rows, html("Total\n"); // The row count arrives through ofs, which carries -1 for "all". - rows = (max_rows <= 0 || (size_t)max_rows > authors->nr) - ? authors->nr : (size_t)max_rows; + rows = (max_rows <= 0 || (size_t)max_rows > authors->nr) ? authors->nr : (size_t)max_rows; for (i = 0; i < rows; i++) { author = &authors->items[i]; @@ -365,11 +360,9 @@ static void print_authors(struct string_list *authors, int max_rows, } if (rows < authors->nr) - print_summary_row(authors, rows, authors->nr - rows, - "Others (%ld)", "left", "", "sum", labels); + print_summary_row(authors, rows, authors->nr - rows, "Others (%ld)", "left", "", "sum", labels); - print_summary_row(authors, 0, authors->nr, "Total", - "total", "sum", "sum", labels); + print_summary_row(authors, 0, authors->nr, "Total", "total", "sum", "sum", labels); html("\n"); } @@ -387,9 +380,7 @@ static void print_options_form(const struct cgit_period *period, int top) html("Period:"); html("\n"); } html("Authors:"); @@ -447,18 +438,15 @@ void cgit_show_stats(void) period_index = cgit_find_stats_period(code, &period); if (!period_index) { - cgit_print_error_page(404, "Not Found", - "Unknown statistics type: %c", code[0]); + cgit_print_error_page(404, "Not Found", "Unknown statistics type: %c", code[0]); return; } if (period_index > ctx.repo->max_stats) { - cgit_print_error_page(400, "Bad Request", - "Statistics type disabled: %s", period->name); + cgit_print_error_page(400, "Bad Request", "Statistics type disabled: %s", period->name); return; } authors = collect_stats(period); - qsort(authors.items, authors.nr, sizeof(struct string_list_item), - cmp_total_commits); + qsort(authors.items, authors.nr, sizeof(struct string_list_item), cmp_total_commits); top = ctx.qry.ofs; if (!top) -- cgit v2.8.0