]> git.cameronkatri.com Git - cgit.git/blobdiff - ui-stats.c
filters: toggle perl utf8 situation
[cgit.git] / ui-stats.c
index 36e17d92da8d5791dd042ebbaceeeec1713fcd03..28b794fd3a1354dd0175047e696a0cd7ca11ad39 100644 (file)
@@ -1,7 +1,7 @@
 #include "cgit.h"
+#include "ui-stats.h"
 #include "html.h"
 #include "ui-shared.h"
-#include "ui-stats.h"
 
 #ifdef NO_C99_FORMAT
 #define SZ_FMT "%u"
@@ -23,21 +23,21 @@ static void trunc_week(struct tm *tm)
 {
        time_t t = timegm(tm);
        t -= ((tm->tm_wday + 6) % 7) * DAY_SECS;
-       gmtime_r(&t, tm);       
+       gmtime_r(&t, tm);
 }
 
 static void dec_week(struct tm *tm)
 {
        time_t t = timegm(tm);
        t -= WEEK_SECS;
-       gmtime_r(&t, tm);       
+       gmtime_r(&t, tm);
 }
 
 static void inc_week(struct tm *tm)
 {
        time_t t = timegm(tm);
        t += WEEK_SECS;
-       gmtime_r(&t, tm);       
+       gmtime_r(&t, tm);
 }
 
 static char *pretty_week(struct tm *tm)
@@ -83,7 +83,7 @@ static char *pretty_month(struct tm *tm)
 static void trunc_quarter(struct tm *tm)
 {
        trunc_month(tm);
-       while(tm->tm_mon % 3 != 0)
+       while (tm->tm_mon % 3 != 0)
                dec_month(tm);
 }
 
@@ -153,7 +153,7 @@ int cgit_find_stats_period(const char *expr, struct cgit_period **period)
                if (periods[i].code == code || !strcmp(periods[i].name, expr)) {
                        if (period)
                                *period = &periods[i];
-                       return i+1;
+                       return i + 1;
                }
        return 0;
 }
@@ -211,8 +211,8 @@ static int cmp_total_commits(const void *a1, const void *a2)
 /* Walk the commit DAG and collect number of commits per author per
  * timeperiod into a nested string_list collection.
  */
-struct string_list collect_stats(struct cgit_context *ctx,
-       struct cgit_period *period)
+static struct string_list collect_stats(struct cgit_context *ctx,
+                                       struct cgit_period *period)
 {
        struct string_list authors;
        struct rev_info rev;
@@ -239,7 +239,7 @@ struct string_list collect_stats(struct cgit_context *ctx,
        init_revisions(&rev, NULL);
        rev.abbrev = DEFAULT_ABBREV;
        rev.commit_format = CMIT_FMT_DEFAULT;
-       rev.no_merges = 1;
+       rev.max_parents = 1;
        rev.verbose_header = 1;
        rev.show_root_diff = 0;
        setup_revisions(argc, argv, &rev, NULL);
@@ -253,9 +253,12 @@ struct string_list collect_stats(struct cgit_context *ctx,
        return authors;
 }
 
-void print_combined_authorrow(struct string_list *authors, int from, int to,
-       const char *name, const char *leftclass, const char *centerclass,
-       const char *rightclass, struct cgit_period *period)
+static void print_combined_authorrow(struct string_list *authors, int from,
+                                    int to, const char *name,
+                                    const char *leftclass,
+                                    const char *centerclass,
+                                    const char *rightclass,
+                                    struct cgit_period *period)
 {
        struct string_list_item *author;
        struct authorstat *authorstat;
@@ -293,8 +296,8 @@ void print_combined_authorrow(struct string_list *authors, int from, int to,
        htmlf("<td class='%s'>%ld</td></tr>", rightclass, total);
 }
 
-void print_authors(struct string_list *authors, int top,
-                  struct cgit_period *period)
+static void print_authors(struct string_list *authors, int top,
+                         struct cgit_period *period)
 {
        struct string_list_item *author;
        struct authorstat *authorstat;
@@ -371,12 +374,11 @@ void cgit_show_stats(struct cgit_context *ctx)
 
        i = cgit_find_stats_period(code, &period);
        if (!i) {
-               cgit_print_error(fmt("Unknown statistics type: %c", code[0]));
+               cgit_print_error("Unknown statistics type: %c", code[0]);
                return;
        }
        if (i > ctx->repo->max_stats) {
-               cgit_print_error(fmt("Statistics type disabled: %s",
-                                    period->name));
+               cgit_print_error("Statistics type disabled: %s", period->name);
                return;
        }
        authors = collect_stats(ctx, period);
@@ -407,7 +409,7 @@ void cgit_show_stats(struct cgit_context *ctx)
        html_intoption(50, "50", top);
        html_intoption(100, "100", top);
        html_intoption(-1, "all", top);
-       html("</select></td><tr>");
+       html("</select></td></tr>");
        html("<tr><td/><td class='ctrl'>");
        html("<noscript><input type='submit' value='Reload'/></noscript>");
        html("</td></tr></table>");