From: Joel Rosdahl Date: Wed, 14 Jul 2010 17:00:06 +0000 (+0200) Subject: Make stats_flush an exit function X-Git-Tag: v3.1~198 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=1ae74b66e1565b49e4e0d5b1d9d097dc65b03df8;p=thirdparty%2Fccache.git Make stats_flush an exit function --- diff --git a/ccache.c b/ccache.c index a1332bfd2..556d6de40 100644 --- a/ccache.c +++ b/ccache.c @@ -253,8 +253,6 @@ static void failed(void) { char *e; - stats_flush(); - /* delete intermediate pre-processor file if needed */ if (i_tmpfile) { if (!direct_i_file) { @@ -706,7 +704,6 @@ static void to_cache(ARGS *args) if (i_tmpfile && !direct_i_file) { unlink(i_tmpfile); } - stats_flush(); exit(status); } } @@ -1288,7 +1285,6 @@ static void from_cache(enum fromcache_call_mode mode, int put_object_in_manifest } /* and exit with the right status code */ - stats_flush(); exit(0); } @@ -2140,6 +2136,7 @@ int main(int argc, char *argv[]) char *program_name; exitfn_init(); + exitfn_add_nullary(stats_flush); /* check for logging early so cc_log messages start working ASAP */ cache_logfile = getenv("CCACHE_LOGFILE"); diff --git a/util.c b/util.c index 254fbd8a9..6f7c781d3 100644 --- a/util.c +++ b/util.c @@ -135,7 +135,6 @@ void fatal(const char *format, ...) fprintf(stderr, "ccache: FATAL: %s\n", msg); - stats_flush(); exit(1); }