diff options
context:
space:
mode:
authorBryce Kwon <bryce@brycekwon.com>
committerBryce Kwon <bryce@brycekwon.com>
commit
parent
tree
download
Clean up the whole tree
Diffstat (limited to 'source/ui-stats.c')
-rw-r--r--source/ui-stats.c38
1 file changed, 13 insertions, 25 deletions
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("<tr><td class='%s'>%s</td>", leftclass,
- cgit_fmt(label_format, (long)count));
+ htmlf("<tr><td class='%s'>%s</td>", 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("<td class='%s'>%ld</td></tr>\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("<th>Total</th></tr>\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("</table>\n");
}
@@ -387,9 +380,7 @@ static void print_options_form(const struct cgit_period *period, int top)
html("<tr><td class='label'>Period:</td>");
html("<td class='ctrl'><select name='period'>");
for (i = 0; i < choices; i++)
- html_option(cgit_fmt("%c", periods[i].code),
- periods[i].name,
- cgit_fmt("%c", period->code));
+ html_option(cgit_fmt("%c", periods[i].code), periods[i].name, cgit_fmt("%c", period->code));
html("</select></td></tr>\n");
}
html("<tr><td class='label'>Authors:</td>");
@@ -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)