diff options
author | jtimon <jtimon@blockstream.io> | 2014-10-11 20:56:27 +0200 |
---|---|---|
committer | jtimon <jtimon@blockstream.io> | 2014-10-11 20:56:27 +0200 |
commit | ebdb9ff63992fe685688f6d47cd1f3a2938ee607 (patch) | |
tree | 01660f20ddfd89f7e3cd9668aab5c88dd90980d7 /src | |
parent | b796cb084bd3865d094d86da2f33cd5c68294a43 (diff) |
SQUASHME: fix "Reserve only one network specific cached path per session"
Diffstat (limited to 'src')
-rw-r--r-- | src/util.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/util.cpp b/src/util.cpp index 7bb65f6584..ae7767a1f5 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -395,7 +395,8 @@ boost::filesystem::path GetDefaultDataDir() #endif } -static boost::filesystem::path pathCached[2]; +static boost::filesystem::path pathCached; +static boost::filesystem::path pathCachedNetSpecific; static CCriticalSection csPathCached; const boost::filesystem::path &GetDataDir(bool fNetSpecific) @@ -404,7 +405,7 @@ const boost::filesystem::path &GetDataDir(bool fNetSpecific) LOCK(csPathCached); - fs::path &path = pathCached[fNetSpecific ? 1 : 0]; + 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. @@ -430,7 +431,8 @@ const boost::filesystem::path &GetDataDir(bool fNetSpecific) void ClearDatadirCache() { - std::fill(&pathCached[0], &pathCached[2], boost::filesystem::path()); + pathCached = boost::filesystem::path(); + pathCachedNetSpecific = boost::filesystem::path(); } boost::filesystem::path GetConfigFile() |