aboutsummaryrefslogtreecommitdiffstats
path: root/ui-stats.c
diff options
context:
space:
mode:
authorJohn Keeping2015-03-08 16:32:23 +0000
committerJason A. Donenfeld2015-03-09 17:40:02 +0100
commitbd9fb0324d776aa5583a70a6125fce47697701b1 (patch)
tree7d5e04c628c39f6cd39ff9d9ebad6160c22e3680 /ui-stats.c
parent0f23d4651c80170574c0ab2f091c0718150631ce (diff)
downloadcgit-bd9fb0324d776aa5583a70a6125fce47697701b1.tar.gz
cgit-bd9fb0324d776aa5583a70a6125fce47697701b1.tar.bz2
cgit-bd9fb0324d776aa5583a70a6125fce47697701b1.zip
ui-stats: make cgit_period definitions 'static const'
These definitions should not be modified (and never are) so we can move them to .rodata. Signed-off-by: John Keeping <john@keeping.me.uk>
Diffstat (limited to 'ui-stats.c')
-rw-r--r--ui-stats.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/ui-stats.c b/ui-stats.c
index a264f6a..9cd8247 100644
--- a/ui-stats.c
+++ b/ui-stats.c
@@ -125,7 +125,7 @@ static char *pretty_year(struct tm *tm)
125 return fmt("%d", tm->tm_year + 1900); 125 return fmt("%d", tm->tm_year + 1900);
126} 126}
127 127
128struct cgit_period periods[] = { 128static const struct cgit_period periods[] = {
129 {'w', "week", 12, 4, trunc_week, dec_week, inc_week, pretty_week}, 129 {'w', "week", 12, 4, trunc_week, dec_week, inc_week, pretty_week},
130 {'m', "month", 12, 4, trunc_month, dec_month, inc_month, pretty_month}, 130 {'m', "month", 12, 4, trunc_month, dec_month, inc_month, pretty_month},
131 {'q', "quarter", 12, 4, trunc_quarter, dec_quarter, inc_quarter, pretty_quarter}, 131 {'q', "quarter", 12, 4, trunc_quarter, dec_quarter, inc_quarter, pretty_quarter},
@@ -136,7 +136,7 @@ struct cgit_period periods[] = {
136 * and update the period pointer to the correcsponding struct. 136 * and update the period pointer to the correcsponding struct.
137 * If no matching code is found, return 0. 137 * If no matching code is found, return 0.
138 */ 138 */
139int cgit_find_stats_period(const char *expr, struct cgit_period **period) 139int cgit_find_stats_period(const char *expr, const struct cgit_period **period)
140{ 140{
141 int i; 141 int i;
142 char code = '\0'; 142 char code = '\0';
@@ -165,7 +165,7 @@ const char *cgit_find_stats_periodname(int idx)
165} 165}
166 166
167static void add_commit(struct string_list *authors, struct commit *commit, 167static void add_commit(struct string_list *authors, struct commit *commit,
168 struct cgit_period *period) 168 const struct cgit_period *period)
169{ 169{
170 struct commitinfo *info; 170 struct commitinfo *info;
171 struct string_list_item *author, *item; 171 struct string_list_item *author, *item;
@@ -209,7 +209,7 @@ static int cmp_total_commits(const void *a1, const void *a2)
209/* Walk the commit DAG and collect number of commits per author per 209/* Walk the commit DAG and collect number of commits per author per
210 * timeperiod into a nested string_list collection. 210 * timeperiod into a nested string_list collection.
211 */ 211 */
212static struct string_list collect_stats(struct cgit_period *period) 212static struct string_list collect_stats(const struct cgit_period *period)
213{ 213{
214 struct string_list authors; 214 struct string_list authors;
215 struct rev_info rev; 215 struct rev_info rev;
@@ -256,7 +256,7 @@ static void print_combined_authorrow(struct string_list *authors, int from,
256 const char *leftclass, 256 const char *leftclass,
257 const char *centerclass, 257 const char *centerclass,
258 const char *rightclass, 258 const char *rightclass,
259 struct cgit_period *period) 259 const struct cgit_period *period)
260{ 260{
261 struct string_list_item *author; 261 struct string_list_item *author;
262 struct authorstat *authorstat; 262 struct authorstat *authorstat;
@@ -295,7 +295,7 @@ static void print_combined_authorrow(struct string_list *authors, int from,
295} 295}
296 296
297static void print_authors(struct string_list *authors, int top, 297static void print_authors(struct string_list *authors, int top,
298 struct cgit_period *period) 298 const struct cgit_period *period)
299{ 299{
300 struct string_list_item *author; 300 struct string_list_item *author;
301 struct authorstat *authorstat; 301 struct authorstat *authorstat;
@@ -363,7 +363,7 @@ static void print_authors(struct string_list *authors, int top,
363void cgit_show_stats(void) 363void cgit_show_stats(void)
364{ 364{
365 struct string_list authors; 365 struct string_list authors;
366 struct cgit_period *period; 366 const struct cgit_period *period;
367 int top, i; 367 int top, i;
368 const char *code = "w"; 368 const char *code = "w";
369 369