Skip to content

Commit 5292245

Browse files
committed
Util: Put mapMultiArgs inside ArgsManager
- Set ArgsManager::mapMultiArgs in ArgsManager::SoftSetArg, ForceSetArg, SoftSetBoolArg
1 parent b3cbd55 commit 5292245

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

src/util.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,6 @@ const char * const BITCOIN_CONF_FILENAME = "bitcoin.conf";
9292
const char * const BITCOIN_PID_FILENAME = "bitcoind.pid";
9393

9494
ArgsManager gArgs;
95-
static std::map<std::string, std::vector<std::string> > _mapMultiArgs;
96-
const std::map<std::string, std::vector<std::string> >& mapMultiArgs = _mapMultiArgs;
9795
bool fPrintToConsole = false;
9896
bool fPrintToDebugLog = true;
9997

@@ -386,7 +384,7 @@ void ArgsManager::ParseParameters(int argc, const char* const argv[])
386384
{
387385
LOCK(cs_args);
388386
mapArgs.clear();
389-
_mapMultiArgs.clear();
387+
mapMultiArgs.clear();
390388

391389
for (int i = 1; i < argc; i++)
392390
{
@@ -414,7 +412,7 @@ void ArgsManager::ParseParameters(int argc, const char* const argv[])
414412
InterpretNegativeSetting(str, strValue);
415413

416414
mapArgs[str] = strValue;
417-
_mapMultiArgs[str].push_back(strValue);
415+
mapMultiArgs[str].push_back(strValue);
418416
}
419417
}
420418

@@ -459,7 +457,7 @@ bool ArgsManager::SoftSetArg(const std::string& strArg, const std::string& strVa
459457
LOCK(cs_args);
460458
if (mapArgs.count(strArg))
461459
return false;
462-
mapArgs[strArg] = strValue;
460+
ForceSetArg(strArg, strValue);
463461
return true;
464462
}
465463

@@ -475,6 +473,7 @@ void ArgsManager::ForceSetArg(const std::string& strArg, const std::string& strV
475473
{
476474
LOCK(cs_args);
477475
mapArgs[strArg] = strValue;
476+
mapMultiArgs[strArg].push_back(strValue);
478477
}
479478

480479

@@ -612,7 +611,7 @@ void ArgsManager::ReadConfigFile(const std::string& confPath)
612611
InterpretNegativeSetting(strKey, strValue);
613612
if (mapArgs.count(strKey) == 0)
614613
mapArgs[strKey] = strValue;
615-
_mapMultiArgs[strKey].push_back(strValue);
614+
mapMultiArgs[strKey].push_back(strValue);
616615
}
617616
}
618617
// If datadir is changed in .conf file:

src/util.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ class CTranslationInterface
4242
boost::signals2::signal<std::string (const char* psz)> Translate;
4343
};
4444

45-
extern const std::map<std::string, std::vector<std::string> >& mapMultiArgs;
4645
extern bool fPrintToConsole;
4746
extern bool fPrintToDebugLog;
4847

@@ -184,6 +183,7 @@ class ArgsManager
184183
protected:
185184
CCriticalSection cs_args;
186185
std::map<std::string, std::string> mapArgs;
186+
std::map<std::string, std::vector<std::string> > mapMultiArgs;
187187
public:
188188
void ParseParameters(int argc, const char*const argv[]);
189189
void ReadConfigFile(const std::string& confPath);

0 commit comments

Comments
 (0)