mirror of
https://github.com/reactos/ccache.git
synced 2025-02-22 12:00:51 +00:00
Fold stats_read_fd() into stats_read()
This commit is contained in:
parent
8544ce8c55
commit
42b3fd0d46
24
stats.c
24
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);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user