]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
Clean up some constants
authorJoel Rosdahl <joel@rosdahl.net>
Sun, 21 Feb 2010 18:42:39 +0000 (19:42 +0100)
committerJoel Rosdahl <joel@rosdahl.net>
Sun, 21 Feb 2010 18:42:39 +0000 (19:42 +0100)
ccache.h
cleanup.c
execute.c
stats.c

index 41b5ff0e36babbd5c6c5c5994aae104a21336872..bfcba1d3f1ea6eacbad432c68e4ea979c914d501 100644 (file)
--- a/ccache.h
+++ b/ccache.h
 #define ATTR_FORMAT(x, y, z)
 #endif
 
-#define STATUS_NOTFOUND 3
-#define STATUS_FATAL 4
-#define STATUS_NOCACHE 5
-
 #ifndef MYNAME
 #define MYNAME "ccache"
 #endif
 
-#define LIMIT_MULTIPLE 0.8
-
-/* default maximum cache size */
-#ifndef DEFAULT_MAXSIZE
-#define DEFAULT_MAXSIZE (1000*1000)
-#endif
-
 /* statistics fields in storage order */
 enum stats {
        STATS_NONE=0,
index 4078ce9edcfa396a49291d4eaec747e2e7d345d0..ba8914aa841b65fcdd211e5e090f9177f5f7597a 100644 (file)
--- a/cleanup.c
+++ b/cleanup.c
 #include <unistd.h>
 #include <time.h>
 
+/*
+ * 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.
+ */
+#define LIMIT_MULTIPLE 0.8
+
 static struct files {
        char *fname;
        time_t mtime;
index ec170a4f550fd696e995fc67b473ec868da26b57..b14b9b35214ffea7c03c91abec48fc51c7c7d71d 100644 (file)
--- a/execute.c
+++ b/execute.c
@@ -45,7 +45,7 @@ int execute(char **argv,
                unlink(path_stdout);
                fd = open(path_stdout, O_WRONLY|O_CREAT|O_TRUNC|O_EXCL|O_BINARY, 0666);
                if (fd == -1) {
-                       exit(STATUS_NOCACHE);
+                       exit(1);
                }
                dup2(fd, 1);
                close(fd);
@@ -53,7 +53,7 @@ int execute(char **argv,
                unlink(path_stderr);
                fd = open(path_stderr, O_WRONLY|O_CREAT|O_TRUNC|O_EXCL|O_BINARY, 0666);
                if (fd == -1) {
-                       exit(STATUS_NOCACHE);
+                       exit(1);
                }
                dup2(fd, 2);
                close(fd);
diff --git a/stats.c b/stats.c
index c8d32a32a1388103d507ade736a9c96996b663f2..6cb424d4d3b0c0cbe22758f877b54743784e4761 100644 (file)
--- a/stats.c
+++ b/stats.c
 extern char *stats_file;
 extern char *cache_dir;
 
+/* default maximum cache size */
+#ifndef DEFAULT_MAXSIZE
+#define DEFAULT_MAXSIZE (1000*1000)
+#endif
+
 #define FLAG_NOZERO 1 /* don't zero with the -z option */
 #define FLAG_ALWAYS 2 /* always show, even if zero */