// ----------------------------------------------------------------------------
// cleanup.c
-void clean_up_dir(struct conf *conf, const char *dir, float limit_multiple);
+void clean_up_dir(struct conf *conf, const char *dir, double limit_multiple);
void clean_up_all(struct conf *conf);
void wipe_all(struct conf *conf);
#include "ccache.h"
-#include <float.h>
#include <math.h>
static struct files {
// Clean up one cache subdirectory.
void
-clean_up_dir(struct conf *conf, const char *dir, float limit_multiple)
+clean_up_dir(struct conf *conf, const char *dir, double limit_multiple)
{
cc_log("Cleaning up cache directory %s", dir);
// 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 = roundf(conf->max_size * limit_multiple / 16);
- files_in_cache_threshold = roundf(conf->max_files * limit_multiple / 16);
+ cache_size_threshold = round(conf->max_size * limit_multiple / 16);
+ files_in_cache_threshold = round(conf->max_files * limit_multiple / 16);
num_files = 0;
cache_size = 0;
traverse(dir, traverse_fn);
// Clean the cache.
- cc_log("Before cleanup: %lu KiB, %.0f files",
- (unsigned long)cache_size / 1024,
- (float)files_in_cache);
+ cc_log("Before cleanup: %.0f KiB, %.0f files",
+ (double)cache_size / 1024,
+ (double)files_in_cache);
bool cleaned = sort_and_clean();
- cc_log("After cleanup: %lu KiB, %.0f files",
- (unsigned long)cache_size / 1024,
- (float)files_in_cache);
+ cc_log("After cleanup: %.0f KiB, %.0f files",
+ (double)cache_size / 1024,
+ (double)files_in_cache);
if (cleaned) {
cc_log("Cleaned up cache directory %s", dir);