]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
Get rid of global variable and improve name
authorJoel Rosdahl <joel@rosdahl.net>
Wed, 19 Jul 2017 20:04:34 +0000 (22:04 +0200)
committerJoel Rosdahl <joel@rosdahl.net>
Wed, 19 Jul 2017 20:04:34 +0000 (22:04 +0200)
ccache.c
unify.c

index 462884471b00014aa2f3d72d29906e47f93727a6..edbc5cc2d3777c5cf607be3bc6ee4e3d1d8079b2 100644 (file)
--- a/ccache.c
+++ b/ccache.c
@@ -81,9 +81,6 @@ char *secondary_config_path = NULL;
 // Current working directory taken from $PWD, or getcwd() if $PWD is bad.
 char *current_working_dir = NULL;
 
-// Print the unified preprocessed source code format, to stdout
-bool unify_print = false;
-
 // The original argument list.
 static struct args *orig_args;
 
@@ -1503,16 +1500,15 @@ get_object_name_from_cpp(struct args *args, struct mdfour *hash)
        }
 
        if (conf->unify) {
-               char *print = getenv("CCACHE_UNIFY_PRINT");
-               unify_print = print != NULL ? true : false;
-
                // When we are doing the unifying tricks we need to include the input file
                // name in the hash to get the warnings right.
                hash_delimiter(hash, "unifyfilename");
                hash_string(hash, input_file);
 
                hash_delimiter(hash, "unifycpp");
-               if (unify_hash(hash, path_stdout, unify_print) != 0) {
+
+               bool debug_unify = getenv("CCACHE_DEBUG_UNIFY");
+               if (unify_hash(hash, path_stdout, debug_unify) != 0) {
                        stats_update(STATS_ERROR);
                        cc_log("Failed to unify %s", path_stdout);
                        failed();
diff --git a/unify.c b/unify.c
index 1a594f140ec3f4be1276317c679b075e2d3a565b..53c3a0faaccc5997262cc9cba89de956598825c9 100644 (file)
--- a/unify.c
+++ b/unify.c
@@ -1,5 +1,5 @@
 // Copyright (C) 2002 Andrew Tridgell
-// Copyright (C) 2009-2016 Joel Rosdahl
+// Copyright (C) 2009-2017 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
@@ -246,7 +246,7 @@ unify(struct mdfour *hash, unsigned char *p, size_t size)
 // Hash a file that consists of preprocessor output, but remove any line number
 // information from the hash.
 int
-unify_hash(struct mdfour *hash, const char *fname, bool print)
+unify_hash(struct mdfour *hash, const char *fname, bool debug)
 {
        char *data;
        size_t size;
@@ -254,7 +254,7 @@ unify_hash(struct mdfour *hash, const char *fname, bool print)
                stats_update(STATS_PREPROCESSOR);
                return -1;
        }
-       print_unified = print;
+       print_unified = debug;
        unify(hash, (unsigned char *)data, size);
        free(data);
        return 0;