From e01e22b2fd2b0577e87c479f3257c85a18cd2a18 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Anders=20F=20Bj=C3=B6rklund?= Date: Sun, 16 Sep 2018 14:40:44 +0200 Subject: [PATCH] Address issues found by lgtm.com alerts --- src/ccache.c | 15 +++++++-------- src/hashtable.c | 2 +- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/ccache.c b/src/ccache.c index 1fc04d3f5..49ebc8e37 100644 --- a/src/ccache.c +++ b/src/ccache.c @@ -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(); diff --git a/src/hashtable.c b/src/hashtable.c index 29cf78ab5..da40cc2f8 100644 --- a/src/hashtable.c +++ b/src/hashtable.c @@ -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; } -- 2.47.2