diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2014-10-17 08:47:11 +0200 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2014-10-17 08:47:11 +0200 |
commit | 494ff05a4cd9d89857342d5c843ed480afcc8fe7 (patch) | |
tree | dbab4f9ea8dfe172b9766b3df0b7cb87ea908b53 /src/util.cpp | |
parent | c2fc9729d15a6a9b1888ec03daef38cf1e2740a9 (diff) | |
parent | ca3ce0fa037a94f2c357ad04d42e5f526cbcb78e (diff) |
Merge pull request #4804 from jtimon/chainparams3
Remove CBaseChainParams::NetworkID()
Diffstat (limited to 'src/util.cpp')
-rw-r--r-- | src/util.cpp | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/src/util.cpp b/src/util.cpp index 632d0965bf..544ffc98b8 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -395,7 +395,8 @@ boost::filesystem::path GetDefaultDataDir() #endif } -static boost::filesystem::path pathCached[CBaseChainParams::MAX_NETWORK_TYPES+1]; +static boost::filesystem::path pathCached; +static boost::filesystem::path pathCachedNetSpecific; static CCriticalSection csPathCached; const boost::filesystem::path &GetDataDir(bool fNetSpecific) @@ -404,10 +405,7 @@ const boost::filesystem::path &GetDataDir(bool fNetSpecific) LOCK(csPathCached); - int nNet = CBaseChainParams::MAX_NETWORK_TYPES; - if (fNetSpecific) nNet = BaseParams().NetworkID(); - - fs::path &path = pathCached[nNet]; + fs::path &path = fNetSpecific ? pathCachedNetSpecific : pathCached; // This can be called during exceptions by LogPrintf(), so we cache the // value so we don't have to do memory allocations after that. @@ -433,8 +431,8 @@ const boost::filesystem::path &GetDataDir(bool fNetSpecific) void ClearDatadirCache() { - std::fill(&pathCached[0], &pathCached[CBaseChainParams::MAX_NETWORK_TYPES+1], - boost::filesystem::path()); + pathCached = boost::filesystem::path(); + pathCachedNetSpecific = boost::filesystem::path(); } boost::filesystem::path GetConfigFile() |