From: Joel Rosdahl Date: Sun, 16 Feb 2020 18:40:58 +0000 (+0100) Subject: Remove now redundant resetting of config X-Git-Tag: v4.0~617 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ae635d22567d144bfc35fb8c95f31bf84584d485;p=thirdparty%2Fccache.git Remove now redundant resetting of config Since the configuation no longer is global there is no need to reset the unmodified Config object passed by cct_test_begin to cc_reset. --- diff --git a/src/Config.cpp b/src/Config.cpp index d3bead7d4..682efe9b2 100644 --- a/src/Config.cpp +++ b/src/Config.cpp @@ -650,12 +650,6 @@ Config::set_value_in_file(const std::string& path, output.commit(); } -void -Config::clear_and_reset() -{ - *this = Config(); -} - void Config::visit_items(const ItemVisitor& item_visitor) const { diff --git a/src/Config.hpp b/src/Config.hpp index ba16f10e4..aea66db17 100644 --- a/src/Config.hpp +++ b/src/Config.hpp @@ -20,6 +20,7 @@ #include "system.hpp" +#include "NonCopyable.hpp" #include "legacy_util.hpp" #include "third_party/fmt/core.h" @@ -32,7 +33,7 @@ class Config; -class Config +class Config : NonCopyable { public: Config() = default; @@ -115,9 +116,6 @@ public: const std::string& key, const std::string& value); - // Clear the Config object and reset all values to defaults. - void clear_and_reset(); - private: std::string m_primary_config_path; std::string m_secondary_config_path; @@ -164,10 +162,6 @@ private: const nonstd::optional& env_var_key, bool negate, const std::string& origin); - - // These exist, but are private to be used in clear_and_reset() - Config(const Config&) = default; - Config& operator=(const Config&) = default; }; inline const std::string& diff --git a/src/ccache.cpp b/src/ccache.cpp index 9d5dedd31..da294b3b7 100644 --- a/src/ccache.cpp +++ b/src/ccache.cpp @@ -3549,10 +3549,8 @@ free_and_nullify(T*& ptr) // Reset the global state. Used by the test suite. void -cc_reset(Config& config) +cc_reset() { - config.clear_and_reset(); - free_and_nullify(current_working_dir); free_and_nullify(included_pch_file); free_and_nullify(cached_result_name); diff --git a/src/ccache.hpp b/src/ccache.hpp index fbe779bc5..8d0bf2569 100644 --- a/src/ccache.hpp +++ b/src/ccache.hpp @@ -70,5 +70,5 @@ bool cc_process_args(Context& ctx, struct args** preprocessor_args, struct args** extra_args_to_hash, struct args** compiler_args); -void cc_reset(Config& config); +void cc_reset(); bool is_precompiled_header(const char* path); diff --git a/unittest/framework.cpp b/unittest/framework.cpp index 04f21d2a1..298ec3cc2 100644 --- a/unittest/framework.cpp +++ b/unittest/framework.cpp @@ -129,7 +129,6 @@ cct_suite_end() void cct_test_begin(const char* name) { - Config config; ++total_tests; if (verbose) { printf("--- TEST: %s ---\n", name); @@ -140,7 +139,6 @@ cct_test_begin(const char* name) current_test = name; x_setenv("CCACHE_CONFIG_PATH", "/dev/null"); - cc_reset(config); } void