From 5fb7b910512226c487c7cc1fcb546618999e0776 Mon Sep 17 00:00:00 2001 From: Michael Cullen Date: Mon, 16 Apr 2018 15:39:00 +0100 Subject: [PATCH] Recreated upstream headless commit 7091db4cc0286a3254107c4f29e3f9b8d183fca1 Upstream referenced a headless commit in https://github.com/ccache/ccache/issues/248 This recreates it so I can make a patch of it --- src/cleanup.c | 7 +++++-- test/suites/cleanup.bash | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/cleanup.c b/src/cleanup.c index 8c46eac..a86e1ea 100644 --- a/src/cleanup.c +++ b/src/cleanup.c @@ -17,6 +17,9 @@ #include "ccache.h" +#include +#include + static struct files { char *fname; time_t mtime; @@ -162,8 +165,8 @@ clean_up_dir(struct conf *conf, const char *dir, float limit_multiple) // When "max files" or "max cache size" is reached, one of the 16 cache // subdirectories is cleaned up. When doing so, files are deleted (in LRU // order) until the levels are below limit_multiple. - cache_size_threshold = conf->max_size * limit_multiple / 16; - files_in_cache_threshold = conf->max_files * limit_multiple / 16; + cache_size_threshold = roundf(conf->max_size * limit_multiple / 16); + files_in_cache_threshold = roundf(conf->max_files * limit_multiple / 16); num_files = 0; cache_size = 0; diff --git a/test/suites/cleanup.bash b/test/suites/cleanup.bash index 8eaac4f..45dccb0 100644 --- a/test/suites/cleanup.bash +++ b/test/suites/cleanup.bash @@ -152,7 +152,7 @@ SUITE_cleanup() { TEST ".o file is removed before .stderr" prepare_cleanup_test_dir $CCACHE_DIR/a - $CCACHE -F 474 -M 0 >/dev/null + $CCACHE -F 464 -M 0 >/dev/null backdate 0 $CCACHE_DIR/a/result9-4017.stderr $CCACHE -c >/dev/null expect_file_missing $CCACHE_DIR/a/result9-4017.stderr @@ -167,7 +167,7 @@ SUITE_cleanup() { TEST ".stderr file is not removed before .o" prepare_cleanup_test_dir $CCACHE_DIR/a - $CCACHE -F 474 -M 0 >/dev/null + $CCACHE -F 464 -M 0 >/dev/null backdate 0 $CCACHE_DIR/a/result9-4017.o $CCACHE -c >/dev/null expect_file_exists $CCACHE_DIR/a/result9-4017.stderr -- 2.14.3