From b1fee8ff634cd497fca7596eb728e143b6357587 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Wed, 15 Mar 2017 23:13:14 +0900 Subject: [PATCH] nghttpx: Use raw pointer for config --- src/shrpx_config.cc | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/shrpx_config.cc b/src/shrpx_config.cc index 3e24bc6e..f29c0db3 100644 --- a/src/shrpx_config.cc +++ b/src/shrpx_config.cc @@ -63,21 +63,22 @@ namespace shrpx { namespace { -std::unique_ptr config; +Config *config; } // namespace constexpr auto SHRPX_UNIX_PATH_PREFIX = StringRef::from_lit("unix:"); -const Config *get_config() { return config.get(); } +const Config *get_config() { return config; } -Config *mod_config() { return config.get(); } +Config *mod_config() { return config; } std::unique_ptr replace_config(std::unique_ptr another) { - config.swap(another); - return another; + auto p = config; + config = another.release(); + return std::unique_ptr(p); } -void create_config() { config = make_unique(); } +void create_config() { config = new Config(); } Config::~Config() { auto &upstreamconf = http2.upstream;