From: Thomas Otto Date: Sun, 26 Jan 2020 20:03:55 +0000 (+0100) Subject: Context: move manifest_stats_file and convert to std::string X-Git-Tag: v4.0~613^2~6 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=019d50327fefa49bf090ce42fb7fb1421936fa46;p=thirdparty%2Fccache.git Context: move manifest_stats_file and convert to std::string --- diff --git a/src/Context.hpp b/src/Context.hpp index b6e7e85de..7af2ec4e4 100644 --- a/src/Context.hpp +++ b/src/Context.hpp @@ -78,4 +78,7 @@ struct Context : NonCopyable // The name of the cpp stderr file. std::string cpp_stderr; + + // The stats file to use for the manifest. + std::string manifest_stats_file; }; diff --git a/src/ccache.cpp b/src/ccache.cpp index 3388d01e2..6b1631ece 100644 --- a/src/ccache.cpp +++ b/src/ccache.cpp @@ -1061,7 +1061,7 @@ update_manifest_file(Context& ctx) } else { auto st = Stat::stat(ctx.manifest_path, Stat::OnError::log); stats_update_size(ctx, - from_cstr(manifest_stats_file), + ctx.manifest_stats_file, st.size_on_disk() - old_st.size_on_disk(), !old_st && st ? 1 : 0); } @@ -1981,8 +1981,8 @@ calculate_result_name(Context& ctx, ctx.config.cache_dir_levels(), manifest_name_string, ".manifest"); - manifest_stats_file = format( - "%s/%c/stats", ctx.config.cache_dir().c_str(), manifest_name_string[0]); + ctx.manifest_stats_file = fmt::format( + "{}/{}/stats", ctx.config.cache_dir(), manifest_name_string[0]); cc_log("Looking for result name in %s", ctx.manifest_path.c_str()); MTR_BEGIN("manifest", "manifest_get"); diff --git a/src/legacy_globals.cpp b/src/legacy_globals.cpp index c5ac74028..57ce0f351 100644 --- a/src/legacy_globals.cpp +++ b/src/legacy_globals.cpp @@ -24,9 +24,6 @@ char** ignore_headers; // Size of headers to ignore list. size_t ignore_headers_len; -// The stats file to use for the manifest. -char* manifest_stats_file; - // Compiler guessing is currently only based on the compiler name, so nothing // should hard-depend on it if possible. enum guessed_compiler guessed_compiler = GUESSED_UNKNOWN; diff --git a/src/legacy_globals.hpp b/src/legacy_globals.hpp index acfce56be..b4996cf6e 100644 --- a/src/legacy_globals.hpp +++ b/src/legacy_globals.hpp @@ -34,8 +34,6 @@ extern char** ignore_headers; extern size_t ignore_headers_len; -extern char* manifest_stats_file; - extern enum guessed_compiler guessed_compiler; extern char* included_pch_file;