aboutsummaryrefslogtreecommitdiff
path: root/src/util.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/util.cpp')
-rw-r--r--src/util.cpp18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/util.cpp b/src/util.cpp
index 8b3e5f93f0..6625ac9325 100644
--- a/src/util.cpp
+++ b/src/util.cpp
@@ -103,7 +103,8 @@ const char * const BITCOIN_CONF_FILENAME = "bitcoin.conf";
const char * const BITCOIN_PID_FILENAME = "bitcoind.pid";
map<string, string> mapArgs;
-map<string, vector<string> > mapMultiArgs;
+static map<string, vector<string> > _mapMultiArgs;
+const map<string, vector<string> >& mapMultiArgs = _mapMultiArgs;
bool fDebug = false;
bool fPrintToConsole = false;
bool fPrintToDebugLog = true;
@@ -238,9 +239,12 @@ bool LogAcceptCategory(const char* category)
static boost::thread_specific_ptr<set<string> > ptrCategory;
if (ptrCategory.get() == NULL)
{
- const vector<string>& categories = mapMultiArgs["-debug"];
- ptrCategory.reset(new set<string>(categories.begin(), categories.end()));
- // thread_specific_ptr automatically deletes the set when the thread ends.
+ if (mapMultiArgs.count("-debug")) {
+ const vector<string>& categories = mapMultiArgs.at("-debug");
+ ptrCategory.reset(new set<string>(categories.begin(), categories.end()));
+ // thread_specific_ptr automatically deletes the set when the thread ends.
+ } else
+ ptrCategory.reset(new set<string>());
}
const set<string>& setCategories = *ptrCategory.get();
@@ -343,7 +347,7 @@ static void InterpretNegativeSetting(std::string& strKey, std::string& strValue)
void ParseParameters(int argc, const char* const argv[])
{
mapArgs.clear();
- mapMultiArgs.clear();
+ _mapMultiArgs.clear();
for (int i = 1; i < argc; i++)
{
@@ -371,7 +375,7 @@ void ParseParameters(int argc, const char* const argv[])
InterpretNegativeSetting(str, strValue);
mapArgs[str] = strValue;
- mapMultiArgs[str].push_back(strValue);
+ _mapMultiArgs[str].push_back(strValue);
}
}
@@ -543,7 +547,7 @@ void ReadConfigFile(const std::string& confPath)
InterpretNegativeSetting(strKey, strValue);
if (mapArgs.count(strKey) == 0)
mapArgs[strKey] = strValue;
- mapMultiArgs[strKey].push_back(strValue);
+ _mapMultiArgs[strKey].push_back(strValue);
}
// If datadir is changed in .conf file:
ClearDatadirCache();