From: Joel Rosdahl Date: Sun, 17 Jul 2011 10:07:33 +0000 (+0200) Subject: config: Assert that conf has been created X-Git-Tag: v3.2~210 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=1050034f7a4da79bac4ff3b6fa9fbdeb5e36a1aa;p=thirdparty%2Fccache.git config: Assert that conf has been created --- diff --git a/stats.c b/stats.c index 585468d4e..9ddcebe69 100644 --- a/stats.c +++ b/stats.c @@ -205,6 +205,8 @@ stats_flush(void) bool should_flush = false; int i; + assert(conf); + if (!conf->stats) { return; } @@ -292,6 +294,8 @@ stats_summary(void) int dir, i; struct counters *counters = counters_init(STATS_END); + assert(conf); + /* add up the stats in each directory */ for (dir = -1; dir <= 0xF; dir++) { char *fname; @@ -341,6 +345,8 @@ stats_zero(void) unsigned i; char *fname; + assert(conf); + fname = format("%s/stats", conf->cache_dir); x_unlink(fname); free(fname); @@ -382,6 +388,8 @@ stats_set_limits(long maxfiles, long maxsize) { int dir; + assert(conf); + if (maxfiles != -1) { maxfiles /= 16; }