]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
do not pass incorrect length to remember_include_file()
authorLuboš Luňák <l.lunak@suse.cz>
Fri, 6 Jul 2012 16:46:25 +0000 (18:46 +0200)
committerJoel Rosdahl <joel@rosdahl.net>
Fri, 13 Jul 2012 20:41:30 +0000 (22:41 +0200)
ccache.c

index 926d6b2ee69d0bb1aef84eb623f5c3e29797dadb..0cc1a3cd2f27eae8cabc2f5bb306f7a4eebb1703 100644 (file)
--- a/ccache.c
+++ b/ccache.c
@@ -307,7 +307,7 @@ get_path_in_cache(const char *name, const char *suffix)
  * also updated. Takes over ownership of path.
  */
 static void
-remember_include_file(char *path, size_t path_len, struct mdfour *cpp_hash)
+remember_include_file(char *path, struct mdfour *cpp_hash)
 {
 #ifdef _WIN32
        DWORD attributes;
@@ -318,6 +318,7 @@ remember_include_file(char *path, size_t path_len, struct mdfour *cpp_hash)
        size_t size;
        int result;
        bool is_pch;
+       size_t path_len = strlen(path);
 
        if (path_len >= 2 && (path[0] == '<' && path[path_len - 1] == '>')) {
                /* Typically <built-in> or <command-line>. */
@@ -528,7 +529,7 @@ process_preprocessed_file(struct mdfour *hash, const char *path)
                        path = x_strndup(p, q - p);
                        path = make_relative_path(path);
                        hash_string(hash, path);
-                       remember_include_file(path, q - p, hash);
+                       remember_include_file(path, hash);
                        p = q;
                } else {
                        q++;
@@ -544,7 +545,7 @@ process_preprocessed_file(struct mdfour *hash, const char *path)
                char *path = x_strdup(included_pch_file);
                path = make_relative_path(path);
                hash_string(hash, path);
-               remember_include_file(path, strlen(included_pch_file), hash);
+               remember_include_file(path, hash);
        }
 
        return true;