diff options
author | Thomas Otto <thomas.otto@pdv-fs.de> | 2020-01-25 10:44:12 +0100 |
---|---|---|
committer | Thomas Otto <thomas.otto@pdv-fs.de> | 2020-02-17 21:39:02 +0100 |
commit | 6a4e0f88b483727ce58a1ff01dd39c47e03e14d4 (patch) | |
tree | e4a8bbdb357328f2a8cffc93ed44839e1efe2b92 /src/ccache.cpp | |
parent | 68fef769210705cabe22b269a43738533ab73839 (diff) | |
download | ccache-6a4e0f88b483727ce58a1ff01dd39c47e03e14d4.tar.gz ccache-6a4e0f88b483727ce58a1ff01dd39c47e03e14d4.tar.bz2 ccache-6a4e0f88b483727ce58a1ff01dd39c47e03e14d4.zip |
Context: move (cached_)result_name/result_path
Also convert result_path to std::string.
Diffstat (limited to 'src/ccache.cpp')
-rw-r--r-- | src/ccache.cpp | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/src/ccache.cpp b/src/ccache.cpp index 3b01c187..8f9cbe99 100644 --- a/src/ccache.cpp +++ b/src/ccache.cpp @@ -1053,7 +1053,7 @@ update_manifest_file(Context& ctx) cc_log("Adding result name to %s", manifest_path); if (!manifest_put(ctx.config, manifest_path, - *cached_result_name, + *ctx.result_name, g_included_files, save_timestamp)) { cc_log("Failed to add result name to %s", manifest_path); @@ -1072,13 +1072,11 @@ update_cached_result_globals(Context& ctx, struct digest* result_name) { char result_name_string[DIGEST_STRING_BUFFER_SIZE]; digest_as_string(result_name, result_name_string); - cached_result_name = result_name; - cached_result_path = - x_strdup(Util::get_path_in_cache(ctx.config.cache_dir(), - ctx.config.cache_dir_levels(), - result_name_string, - ".result") - .c_str()); + ctx.result_name = result_name; + ctx.result_path = Util::get_path_in_cache(ctx.config.cache_dir(), + ctx.config.cache_dir_levels(), + result_name_string, + ".result"); ctx.stats_file = fmt::format("{}/{}/stats", ctx.config.cache_dir(), result_name_string[0]); } @@ -1340,12 +1338,12 @@ to_cache(Context& ctx, result_file_map.emplace(FileType::dwarf_object, ctx.args_info.output_dwo); } - auto orig_dest_stat = Stat::stat(cached_result_path); - result_put(ctx, cached_result_path, result_file_map); + auto orig_dest_stat = Stat::stat(ctx.result_path); + result_put(ctx, ctx.result_path, result_file_map); - cc_log("Stored in cache: %s", cached_result_path); + cc_log("Stored in cache: %s", ctx.result_path.c_str()); - auto new_dest_stat = Stat::stat(cached_result_path, Stat::OnError::log); + auto new_dest_stat = Stat::stat(ctx.result_path, Stat::OnError::log); if (!new_dest_stat) { stats_update(STATS_ERROR); failed(); @@ -2079,7 +2077,7 @@ from_cache(Context& ctx, if (ctx.args_info.generating_diagnostics) { result_file_map.emplace(FileType::diagnostic, ctx.args_info.output_dia); } - bool ok = result_get(ctx, cached_result_path, result_file_map); + bool ok = result_get(ctx, ctx.result_path, result_file_map); if (!ok) { cc_log("Failed to get result from cache"); tmp_unlink(tmp_stderr); @@ -3529,8 +3527,6 @@ void cc_reset() { free_and_nullify(included_pch_file); - free_and_nullify(cached_result_name); - free_and_nullify(cached_result_path); free_and_nullify(manifest_path); time_of_compilation = 0; for (size_t i = 0; i < ignore_headers_len; i++) { |