]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
Fold stats_read_fd() into stats_read()
authorJoel Rosdahl <joel@rosdahl.net>
Tue, 3 Aug 2010 15:16:38 +0000 (17:16 +0200)
committerJoel Rosdahl <joel@rosdahl.net>
Tue, 3 Aug 2010 15:16:38 +0000 (17:16 +0200)
stats.c

diff --git a/stats.c b/stats.c
index 02e789854fed07ba50440eca86ce59f3dd830445..8e43772fef6c7e0adacea73b9e41c639d3b94bb6 100644 (file)
--- a/stats.c
+++ b/stats.c
@@ -137,21 +137,6 @@ stats_default(unsigned counters[STATS_END])
        counters[STATS_MAXSIZE] += DEFAULT_MAXSIZE / 16;
 }
 
-/* read in the stats from one dir and add to the counters */
-static void
-stats_read_fd(int fd, unsigned counters[STATS_END])
-{
-       char buf[1024];
-       int len;
-       len = read(fd, buf, sizeof(buf)-1);
-       if (len <= 0) {
-               stats_default(counters);
-               return;
-       }
-       buf[len] = 0;
-       parse_stats(counters, buf);
-}
-
 /*
  * Update a statistics counter (unless it's STATS_NONE) and also record that a
  * number of bytes and files have been added to the cache. Size is in KiB.
@@ -253,7 +238,14 @@ stats_read(const char *path, unsigned counters[STATS_END])
        if (fd == -1) {
                stats_default(counters);
        } else {
-               stats_read_fd(fd, counters);
+               char buf[1024];
+               int len = read(fd, buf, sizeof(buf)-1);
+               if (len <= 0) {
+                       stats_default(counters);
+                       return;
+               }
+               buf[len] = 0;
+               parse_stats(counters, buf);
                close(fd);
        }
 }