File tree Expand file tree Collapse file tree 1 file changed +13
-7
lines changed
src/xrCore/FormatParsers/XML Expand file tree Collapse file tree 1 file changed +13
-7
lines changed Original file line number Diff line number Diff line change 44#include " xrXMLParser.h"
55#include " AsureXML.h"
66
7- static xr_hash_map<xr_string, xr_shared_ptr<xr_string>> g_xmlCache;
7+ static xr_hash_map<xr_string, xr_shared_ptr<xr_string>>& GetXMLCache ()
8+ {
9+ static xr_hash_map<xr_string, xr_shared_ptr<xr_string>> g_xmlCache;
10+ return g_xmlCache;
11+ }
812
913void CXml::InvalidateCache ()
1014{
11- g_xmlCache .clear ();
15+ GetXMLCache () .clear ();
1216 Msg (" XML cache invalidated" );
1317}
1418
@@ -150,8 +154,9 @@ bool CXml::Load(LPCSTR path, LPCSTR xml_filename)
150154 xr_shared_ptr<xr_string> cachedContent;
151155
152156 {
153- auto it = g_xmlCache.find (cacheKey);
154- if (it != g_xmlCache.end ())
157+ auto & Cache = GetXMLCache ();
158+ auto it = Cache.find (cacheKey);
159+ if (it != Cache.end ())
155160 {
156161 cachedContent = it->second ;
157162 }
@@ -217,10 +222,11 @@ bool CXml::Load(LPCSTR path, LPCSTR xml_filename)
217222
218223 cachedContent = xr_make_shared<xr_string>(printer.CStr ());
219224 {
220- auto it = g_xmlCache.find (cacheKey);
221- if (it == g_xmlCache.end ())
225+ auto & Cache = GetXMLCache ();
226+ auto it = Cache.find (cacheKey);
227+ if (it == Cache.end ())
222228 {
223- g_xmlCache .emplace (cacheKey, cachedContent);
229+ Cache .emplace (cacheKey, cachedContent);
224230 }
225231 else
226232 {
You can’t perform that action at this time.
0 commit comments