mirror of
https://github.com/reactos/ccache.git
synced 2024-11-23 11:49:41 +00:00
config: Use log_file from conf struct
This commit is contained in:
parent
ab81449ac4
commit
5dae03bd12
6
ccache.c
6
ccache.c
@ -76,9 +76,6 @@ struct conf *conf = NULL;
|
||||
/* current working directory taken from $PWD, or getcwd() if $PWD is bad */
|
||||
char *current_working_dir = NULL;
|
||||
|
||||
/* the debug logfile name, if set */
|
||||
char *cache_logfile = NULL;
|
||||
|
||||
/* the original argument list */
|
||||
static struct args *orig_args;
|
||||
|
||||
@ -1829,8 +1826,6 @@ initialize(void)
|
||||
exitfn_add_nullary(stats_flush);
|
||||
exitfn_add_nullary(clean_up_tmp_files);
|
||||
|
||||
/* check for logging early so cc_log messages start working ASAP */
|
||||
cache_logfile = getenv("CCACHE_LOGFILE");
|
||||
cc_log("=== CCACHE STARTED =========================================");
|
||||
|
||||
/* the user might have set CCACHE_UMASK */
|
||||
@ -1853,7 +1848,6 @@ cc_reset(void)
|
||||
{
|
||||
conf_free(conf); conf = NULL;
|
||||
free(current_working_dir); current_working_dir = NULL;
|
||||
cache_logfile = NULL;
|
||||
args_free(orig_args); orig_args = NULL;
|
||||
free(input_file); input_file = NULL;
|
||||
free(output_obj); output_obj = NULL;
|
||||
|
4
stats.c
4
stats.c
@ -204,7 +204,6 @@ stats_flush(void)
|
||||
bool need_cleanup = false;
|
||||
bool should_flush = false;
|
||||
int i;
|
||||
extern char *cache_logfile;
|
||||
|
||||
if (getenv("CCACHE_NOSTATS")) return;
|
||||
|
||||
@ -225,6 +224,7 @@ stats_flush(void)
|
||||
* A NULL stats_file means that we didn't get past calculate_object_hash(),
|
||||
* so we just choose one of stats files in the 16 subdirectories.
|
||||
*/
|
||||
assert(conf);
|
||||
stats_dir = format("%s/%x", conf->cache_dir, hash_from_int(getpid()) % 16);
|
||||
stats_file = format("%s/stats", stats_dir);
|
||||
free(stats_dir);
|
||||
@ -241,7 +241,7 @@ stats_flush(void)
|
||||
stats_write(stats_file, counters);
|
||||
lockfile_release(stats_file);
|
||||
|
||||
if (cache_logfile) {
|
||||
if (!str_eq(conf->log_file, "")) {
|
||||
for (i = 0; i < STATS_END; ++i) {
|
||||
if (counter_updates->data[stats_info[i].stat] != 0
|
||||
&& !(stats_info[i].flags & FLAG_NOZERO)) {
|
||||
|
@ -115,8 +115,6 @@ cct_suite_end()
|
||||
void
|
||||
cct_test_begin(const char *name)
|
||||
{
|
||||
extern char *cache_logfile;
|
||||
|
||||
++total_tests;
|
||||
if (verbose) {
|
||||
printf("--- TEST: %s ---\n", name);
|
||||
@ -128,7 +126,6 @@ cct_test_begin(const char *name)
|
||||
|
||||
putenv("CCACHE_CONFIG_PATH=/dev/null");
|
||||
cc_reset();
|
||||
cache_logfile = getenv("CCACHE_LOGFILE");
|
||||
}
|
||||
|
||||
void
|
||||
|
8
util.c
8
util.c
@ -18,6 +18,7 @@
|
||||
*/
|
||||
|
||||
#include "ccache.h"
|
||||
#include "conf.h"
|
||||
|
||||
#include <zlib.h>
|
||||
|
||||
@ -38,15 +39,16 @@ static FILE *logfile;
|
||||
static bool
|
||||
init_log(void)
|
||||
{
|
||||
extern char *cache_logfile;
|
||||
extern struct conf *conf;
|
||||
|
||||
if (logfile) {
|
||||
return true;
|
||||
}
|
||||
if (!cache_logfile) {
|
||||
assert(conf);
|
||||
if (str_eq(conf->log_file, "")) {
|
||||
return false;
|
||||
}
|
||||
logfile = fopen(cache_logfile, "a");
|
||||
logfile = fopen(conf->log_file, "a");
|
||||
if (logfile) {
|
||||
return true;
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user