]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
Add .o suffix to stored object files for consistency
authorJoel Rosdahl <joel@rosdahl.net>
Sun, 21 Feb 2010 20:14:51 +0000 (21:14 +0100)
committerJoel Rosdahl <joel@rosdahl.net>
Sun, 21 Feb 2010 20:14:51 +0000 (21:14 +0100)
ccache.c
cleanup.c

index e79fa67cec6fd40cca06c22568d68474435751f9..8ef65b4bfeeeadac107cc0c541356c4f04dbdc17 100644 (file)
--- a/ccache.c
+++ b/ccache.c
@@ -76,7 +76,7 @@ static struct file_hash *object_hash;
 
 /*
  * Full path to the file containing the cached object code
- * (cachedir/a/b/cdef[...]-size).
+ * (cachedir/a/b/cdef[...]-size.o).
  */
 static char *cached_obj;
 
@@ -847,7 +847,7 @@ static int find_hash(ARGS *args, enum findhash_call_mode mode)
        }
 
        object_name = format_file_hash(object_hash);
-       cached_obj = get_path_in_cache(object_name, "", nlevels);
+       cached_obj = get_path_in_cache(object_name, ".o", nlevels);
        cached_stderr = get_path_in_cache(object_name, ".stderr", nlevels);
        cached_dep = get_path_in_cache(object_name, ".d", nlevels);
        x_asprintf(&stats_file, "%s/%c/stats", cache_dir, object_name[0]);
index ba8914aa841b65fcdd211e5e090f9177f5f7597a..af6e9137eb8c1ce70d56b0c0475fa4ee8460f143 100644 (file)
--- a/cleanup.c
+++ b/cleanup.c
@@ -51,8 +51,20 @@ static size_t object_files_threshold;
 static int is_object_file(const char *fname)
 {
        int i;
+       int len;
 
-       for (i = strlen(fname) - 1; i >= 0; i--) {
+       len = strlen(fname);
+       if (len < 2) {
+               return 0;
+       }
+
+       /* ccache 3.0 and later: */
+       if (len >= 2 && fname[len - 2] == '.' && fname[len - 1] == 'o') {
+               return 1;
+       }
+
+       /* ccache 2.4 and earlier: */
+       for (i = len - 1; i >= 0; i--) {
                if (fname[i] == '.') {
                        return 0;
                } else if (fname[i] == '-') {