]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
Make stats_flush an exit function
authorJoel Rosdahl <joel@rosdahl.net>
Wed, 14 Jul 2010 17:00:06 +0000 (19:00 +0200)
committerJoel Rosdahl <joel@rosdahl.net>
Wed, 14 Jul 2010 17:00:06 +0000 (19:00 +0200)
ccache.c
util.c

index a1332bfd2dca2c6e515733ae4338ddd6fb480ccd..556d6de4014ba1633db5c72313e336fbad972737 100644 (file)
--- 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 254fbd8a9bff0bc3e5c4c163c85ab5db4857f539..6f7c781d378d13d77e03ef13209554b2435238e3 100644 (file)
--- 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);
 }