]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
Address issues found by lgtm.com alerts 314/head
authorAnders F Björklund <anders.f.bjorklund@gmail.com>
Sun, 16 Sep 2018 12:40:44 +0000 (14:40 +0200)
committerAnders F Björklund <anders.f.bjorklund@gmail.com>
Sun, 16 Sep 2018 12:40:44 +0000 (14:40 +0200)
src/ccache.c
src/hashtable.c

index 1fc04d3f5bddb3374cdc450eb0f32a91aa96315c..49ebc8e37631cf5851b313352112ec8534f8334e 100644 (file)
@@ -934,10 +934,10 @@ process_preprocessed_file(struct mdfour *hash, const char *path, bool pump)
        // Explicitly check the .gch/.pch/.pth file, Clang does not include any
        // mention of it in the preprocessed output.
        if (included_pch_file) {
-               char *path = x_strdup(included_pch_file);
-               path = make_relative_path(path);
-               hash_string(hash, path);
-               remember_include_file(path, hash, false);
+               char *pch_path = x_strdup(included_pch_file);
+               pch_path = make_relative_path(pch_path);
+               hash_string(hash, pch_path);
+               remember_include_file(pch_path, hash, false);
        }
 
        return true;
@@ -1042,8 +1042,7 @@ do_copy_or_move_file_to_cache(const char *source, const char *dest, bool copy)
                if (do_link) {
                        x_unlink(dest);
                        int ret = link(source, dest);
-                       if (ret == 0) {
-                       } else {
+                       if (ret != 0) {
                                cc_log("Failed to link %s to %s: %s", source, dest, strerror(errno));
                                cc_log("Falling back to copying");
                                do_link = false;
@@ -3121,7 +3120,7 @@ out:
 }
 
 static void
-create_initial_config_file(struct conf *conf, const char *path)
+create_initial_config_file(const char *path)
 {
        if (create_parent_dirs(path) != 0) {
                return;
@@ -3212,7 +3211,7 @@ initialize(void)
        }
 
        if (should_create_initial_config) {
-               create_initial_config_file(conf, primary_config_path);
+               create_initial_config_file(primary_config_path);
        }
 
        exitfn_init();
index 29cf78ab53582f00b561db2ac0f9a302c3cf6e57..da40cc2f8c95423593e376fd771ca56b58eb76de 100644 (file)
@@ -77,7 +77,7 @@ create_hashtable(unsigned int minsize,
     h->entrycount   = 0;
     h->hashfn       = hashf;
     h->eqfn         = eqf;
-    h->loadlimit    = (unsigned int) ceil(size * max_load_factor);
+    h->loadlimit    = (unsigned int) ceilf((float) size * max_load_factor);
     return h;
 }