]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
Minor coding style tweaks
authorJoel Rosdahl <joel@rosdahl.net>
Sun, 8 Dec 2013 09:10:39 +0000 (10:10 +0100)
committerJoel Rosdahl <joel@rosdahl.net>
Wed, 1 Jan 2014 19:40:13 +0000 (20:40 +0100)
ccache.c
cleanup.c
conf.c
execute.c
language.c
mdfour.c

index 90c38e748e3f31e310e249d93c69d38c61085b30..4b63c68c4f2d053e4b07660a57b946eda788ec5b 100644 (file)
--- a/ccache.c
+++ b/ccache.c
@@ -926,7 +926,7 @@ get_object_name_from_cpp(struct args *args, struct mdfour *hash)
           maximum filename length limits */
        input_base = basename(input_file);
        tmp = strchr(input_base, '.');
-       if (tmp != NULL) {
+       if (tmp) {
                *tmp = 0;
        }
        if (strlen(input_base) > 10) {
@@ -1299,7 +1299,7 @@ calculate_object_hash(struct args *args, struct mdfour *hash, int direct_mode)
                        "OBJCPLUS_INCLUDE_PATH", /* clang */
                        NULL
                };
-               for (p = envvars; *p != NULL; ++p) {
+               for (p = envvars; *p; ++p) {
                        char *v = getenv(*p);
                        if (v) {
                                hash_delimiter(hash, *p);
@@ -2204,7 +2204,7 @@ cc_process_args(struct args *args, struct args **preprocessor_args,
        }
 
        output_is_precompiled_header =
-               actual_language && strstr(actual_language, "-header") != NULL;
+               actual_language && strstr(actual_language, "-header");
 
        if (!found_c_opt) {
                if (output_is_precompiled_header) {
index 8e5e6cde1e62c2806b8d41ec8dfecadc4f741eac..0de706258e097ff5790ea11e9ad9fab8d3afcfe2 100644 (file)
--- a/cleanup.c
+++ b/cleanup.c
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2002-2006 Andrew Tridgell
- * Copyright (C) 2009-2011 Joel Rosdahl
+ * Copyright (C) 2009-2011, 2013 Joel Rosdahl
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License as published by the Free
@@ -70,7 +70,7 @@ traverse_fn(const char *fname, struct stat *st)
                goto out;
        }
 
-       if (strstr(p, ".tmp.") != NULL) {
+       if (strstr(p, ".tmp.")) {
                /* delete any tmp files older than 1 hour */
                if (st->st_mtime + 3600 < time(NULL)) {
                        x_unlink(fname);
diff --git a/conf.c b/conf.c
index 1b1b2b7c70fd046ebf8097cd88f3501cee4c0420..b49ba3c87577534ade070f699255dbb9b9cf1f42 100644 (file)
--- a/conf.c
+++ b/conf.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2011-2012 Joel Rosdahl
+ * Copyright (C) 2011-2013 Joel Rosdahl
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License as published by the Free
@@ -58,7 +58,7 @@ parse_env_string(const char *str, void *result, char **errmsg)
        char **value = (char **)result;
        free(*value);
        *value = subst_env_in_string(str, errmsg);
-       return *value != NULL;
+       return *value;
 }
 
 static bool
index 2d295d40353987150f475a154534737b5dd6edd2..9f7dbe97b9ded5c1e464699dd359e322dae90c05 100644 (file)
--- a/execute.c
+++ b/execute.c
@@ -58,7 +58,7 @@ win32argvtos(char *prefix, char **argv)
        } while ((arg = argv[i++]));
 
        str = ptr = malloc(l + 1);
-       if (str == NULL)
+       if (!str)
                return NULL;
 
        i = 0;
index 3700476f828ccf01af2f5d435cd60c90318e2328..110066ac957c823241566637e8bbbe657cca04f8 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2010 Joel Rosdahl
+ * Copyright (C) 2010, 2013 Joel Rosdahl
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License as published by the Free
@@ -147,7 +147,7 @@ extension_for_language(const char *language)
 bool
 language_is_supported(const char *language)
 {
-       return p_language_for_language(language) != NULL;
+       return p_language_for_language(language);
 }
 
 bool
index 6e2f58425249a9519d7e00ea41ad7bcaecbf899b..a3218391729f8955bf2236c409a3a14d98422943 100644 (file)
--- a/mdfour.c
+++ b/mdfour.c
@@ -161,7 +161,7 @@ mdfour_update(struct mdfour *md, const unsigned char *in, size_t n)
 
        m = md;
 
-       if (in == NULL) {
+       if (!in) {
                if (!md->finalized) {
                        mdfour_tail(md->tail, md->tail_len);
                        md->finalized = 1;