Browse Source

Util: Put mapMultiArgs inside ArgsManager

- Set ArgsManager::mapMultiArgs in ArgsManager::SoftSetArg, ForceSetArg, SoftSetBoolArg
0.15
Jorge Timón 8 years ago
parent
commit
52922456b8
No known key found for this signature in database
GPG Key ID: 8866C18EA1C944A2
  1. 11
      src/util.cpp
  2. 2
      src/util.h

11
src/util.cpp

@ -92,8 +92,6 @@ const char * const BITCOIN_CONF_FILENAME = "bitcoin.conf";
const char * const BITCOIN_PID_FILENAME = "bitcoind.pid"; const char * const BITCOIN_PID_FILENAME = "bitcoind.pid";
ArgsManager gArgs; ArgsManager gArgs;
static std::map<std::string, std::vector<std::string> > _mapMultiArgs;
const std::map<std::string, std::vector<std::string> >& mapMultiArgs = _mapMultiArgs;
bool fPrintToConsole = false; bool fPrintToConsole = false;
bool fPrintToDebugLog = true; bool fPrintToDebugLog = true;
@ -386,7 +384,7 @@ void ArgsManager::ParseParameters(int argc, const char* const argv[])
{ {
LOCK(cs_args); LOCK(cs_args);
mapArgs.clear(); mapArgs.clear();
_mapMultiArgs.clear(); mapMultiArgs.clear();
for (int i = 1; i < argc; i++) for (int i = 1; i < argc; i++)
{ {
@ -414,7 +412,7 @@ void ArgsManager::ParseParameters(int argc, const char* const argv[])
InterpretNegativeSetting(str, strValue); InterpretNegativeSetting(str, strValue);
mapArgs[str] = strValue; mapArgs[str] = strValue;
_mapMultiArgs[str].push_back(strValue); mapMultiArgs[str].push_back(strValue);
} }
} }
@ -459,7 +457,7 @@ bool ArgsManager::SoftSetArg(const std::string& strArg, const std::string& strVa
LOCK(cs_args); LOCK(cs_args);
if (mapArgs.count(strArg)) if (mapArgs.count(strArg))
return false; return false;
mapArgs[strArg] = strValue; ForceSetArg(strArg, strValue);
return true; return true;
} }
@ -475,6 +473,7 @@ void ArgsManager::ForceSetArg(const std::string& strArg, const std::string& strV
{ {
LOCK(cs_args); LOCK(cs_args);
mapArgs[strArg] = strValue; mapArgs[strArg] = strValue;
mapMultiArgs[strArg].push_back(strValue);
} }
@ -612,7 +611,7 @@ void ArgsManager::ReadConfigFile(const std::string& confPath)
InterpretNegativeSetting(strKey, strValue); InterpretNegativeSetting(strKey, strValue);
if (mapArgs.count(strKey) == 0) if (mapArgs.count(strKey) == 0)
mapArgs[strKey] = strValue; mapArgs[strKey] = strValue;
_mapMultiArgs[strKey].push_back(strValue); mapMultiArgs[strKey].push_back(strValue);
} }
} }
// If datadir is changed in .conf file: // If datadir is changed in .conf file:

2
src/util.h

@ -42,7 +42,6 @@ public:
boost::signals2::signal<std::string (const char* psz)> Translate; boost::signals2::signal<std::string (const char* psz)> Translate;
}; };
extern const std::map<std::string, std::vector<std::string> >& mapMultiArgs;
extern bool fPrintToConsole; extern bool fPrintToConsole;
extern bool fPrintToDebugLog; extern bool fPrintToDebugLog;
@ -184,6 +183,7 @@ class ArgsManager
protected: protected:
CCriticalSection cs_args; CCriticalSection cs_args;
std::map<std::string, std::string> mapArgs; std::map<std::string, std::string> mapArgs;
std::map<std::string, std::vector<std::string> > mapMultiArgs;
public: public:
void ParseParameters(int argc, const char*const argv[]); void ParseParameters(int argc, const char*const argv[]);
void ReadConfigFile(const std::string& confPath); void ReadConfigFile(const std::string& confPath);

Loading…
Cancel
Save