From 10a746d8b1a83ab5f48e326de1fd4d3f3b4200ec Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Sun, 8 Dec 2013 14:52:58 +0100 Subject: [PATCH] debugging: debug options can be turned off internally again --- src/common/debugging.cpp | 5 ++++- src/common/debugging.h | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/common/debugging.cpp b/src/common/debugging.cpp index b3357aa03..739f30d03 100644 --- a/src/common/debugging.cpp +++ b/src/common/debugging.cpp @@ -42,7 +42,8 @@ debugging_requested(const std::string &option, } void -request_debugging(const std::string &options) { +request_debugging(const std::string &options, + bool enable) { std::vector all_options = split(options); for (auto &one_option : all_options) { @@ -51,6 +52,8 @@ request_debugging(const std::string &options) { continue; if (parts[0] == "!") s_debugging_options.clear(); + else if (!enable) + s_debugging_options.erase(parts[0]); else s_debugging_options[parts[0]] = 1 == parts.size() ? std::string("") : parts[1]; } diff --git a/src/common/debugging.h b/src/common/debugging.h index 58eebffb1..b323a16b3 100644 --- a/src/common/debugging.h +++ b/src/common/debugging.h @@ -18,7 +18,7 @@ bool debugging_requested(const char *option, std::string *arg = nullptr); bool debugging_requested(const std::string &option, std::string *arg = nullptr); -void request_debugging(const std::string &options); +void request_debugging(const std::string &options, bool enable = true); void init_debugging(); int parse_debug_interval_arg(const std::string &option, int default_value = 1000, int invalid_value = -1);