From: Joel Rosdahl Date: Wed, 19 Jul 2017 20:04:34 +0000 (+0200) Subject: Get rid of global variable and improve name X-Git-Tag: v3.4~55 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7ebe5fe95905c6ea8642a78a164063fa23f7ab74;p=thirdparty%2Fccache.git Get rid of global variable and improve name --- diff --git a/ccache.c b/ccache.c index 462884471..edbc5cc2d 100644 --- 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 1a594f140..53c3a0faa 100644 --- 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;