summaryrefslogtreecommitdiffabout
authorJohan Herland <johan@herland.net>2010-11-15 17:39:48 (UTC)
committer Lars Hjemli <hjemli@gmail.com>2010-11-16 05:56:54 (UTC)
commit17596459fe9a43428a261e66f65b227d15bf7ee5 (patch) (side-by-side diff)
treeea30f9af3e534a2d2400ece912939475f84211da
parent7618cac1ee3bf83424d9237c3c362a43c5b246e9 (diff)
downloadcgit-17596459fe9a43428a261e66f65b227d15bf7ee5.zip
cgit-17596459fe9a43428a261e66f65b227d15bf7ee5.tar.gz
cgit-17596459fe9a43428a261e66f65b227d15bf7ee5.tar.bz2
ui-stats: Remove unnecessary #include
<string-list.h> is already #included from cgit.h Signed-off-by: Johan Herland <johan@herland.net> Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--ui-stats.c2
1 files changed, 0 insertions, 2 deletions
diff --git a/ui-stats.c b/ui-stats.c
index 946a6ea..2a0c174 100644
--- a/ui-stats.c
+++ b/ui-stats.c
@@ -1,98 +1,96 @@
-#include <string-list.h>
-
#include "cgit.h"
#include "html.h"
#include "ui-shared.h"
#include "ui-stats.h"
#ifdef NO_C99_FORMAT
#define SZ_FMT "%u"
#else
#define SZ_FMT "%zu"
#endif
#define MONTHS 6
struct authorstat {
long total;
struct string_list list;
};
#define DAY_SECS (60 * 60 * 24)
#define WEEK_SECS (DAY_SECS * 7)
static void trunc_week(struct tm *tm)
{
time_t t = timegm(tm);
t -= ((tm->tm_wday + 6) % 7) * DAY_SECS;
gmtime_r(&t, tm);
}
static void dec_week(struct tm *tm)
{
time_t t = timegm(tm);
t -= WEEK_SECS;
gmtime_r(&t, tm);
}
static void inc_week(struct tm *tm)
{
time_t t = timegm(tm);
t += WEEK_SECS;
gmtime_r(&t, tm);
}
static char *pretty_week(struct tm *tm)
{
static char buf[10];
strftime(buf, sizeof(buf), "W%V %G", tm);
return buf;
}
static void trunc_month(struct tm *tm)
{
tm->tm_mday = 1;
}
static void dec_month(struct tm *tm)
{
tm->tm_mon--;
if (tm->tm_mon < 0) {
tm->tm_year--;
tm->tm_mon = 11;
}
}
static void inc_month(struct tm *tm)
{
tm->tm_mon++;
if (tm->tm_mon > 11) {
tm->tm_year++;
tm->tm_mon = 0;
}
}
static char *pretty_month(struct tm *tm)
{
static const char *months[] = {
"Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
};
return fmt("%s %d", months[tm->tm_mon], tm->tm_year + 1900);
}
static void trunc_quarter(struct tm *tm)
{
trunc_month(tm);
while(tm->tm_mon % 3 != 0)
dec_month(tm);
}
static void dec_quarter(struct tm *tm)
{
dec_month(tm);
dec_month(tm);
dec_month(tm);
}