diff --git a/SystemTools.cxx b/SystemTools.cxx index d72cf2350a33a5cf128a6558bc5d37969cccf142..984ea639739839d3e1d647bc881f36c087b97a95 100644 --- a/SystemTools.cxx +++ b/SystemTools.cxx @@ -463,6 +463,10 @@ class SystemToolsEnvMap : public std::map<std::string, std::string> */ class SystemToolsStatic { +public: +#ifdef __CYGWIN__ + SystemToolsTranslationMap Cyg2Win32Map; +#endif }; // adds the elements of the env variable path to the arg passed in @@ -1323,18 +1327,18 @@ int SystemTools::Stat(const std::string& path, SystemTools::Stat_t* buf) #ifdef __CYGWIN__ bool SystemTools::PathCygwinToWin32(const char* path, char* win32_path) { - SystemToolsTranslationMap::iterator i = - SystemTools::Cyg2Win32Map->find(path); + SystemToolsTranslationMap::iterator itr = + SystemTools::Statics->Cyg2Win32Map.find(path); - if (i != SystemTools::Cyg2Win32Map->end()) { - strncpy(win32_path, i->second.c_str(), MAX_PATH); + if (itr != SystemTools::Statics->Cyg2Win32Map.end()) { + strncpy(win32_path, itr->second.c_str(), MAX_PATH); } else { if (cygwin_conv_path(CCP_POSIX_TO_WIN_A, path, win32_path, MAX_PATH) != 0) { win32_path[0] = 0; } - SystemToolsTranslationMap::value_type entry(path, win32_path); - SystemTools::Cyg2Win32Map->insert(entry); + SystemTools::Statics->Cyg2Win32Map.insert( + SystemToolsTranslationMap::value_type(path, win32_path)); } return win32_path[0] != 0; } @@ -4666,9 +4670,6 @@ SystemToolsTranslationMap* SystemTools::TranslationMap; SystemToolsPathCaseMap* SystemTools::PathCaseMap; SystemToolsEnvMap* SystemTools::EnvMap; #endif -#ifdef __CYGWIN__ -SystemToolsTranslationMap* SystemTools::Cyg2Win32Map; -#endif SystemToolsStatic* SystemTools::Statics; // SystemToolsManager manages the SystemTools singleton. @@ -4716,9 +4717,6 @@ void SystemTools::ClassInitialize() #ifdef _WIN32 SystemTools::PathCaseMap = new SystemToolsPathCaseMap; SystemTools::EnvMap = new SystemToolsEnvMap; -#endif -#ifdef __CYGWIN__ - SystemTools::Cyg2Win32Map = new SystemToolsTranslationMap; #endif // Create statics singleton instance SystemTools::Statics = new SystemToolsStatic; @@ -4773,9 +4771,6 @@ void SystemTools::ClassFinalize() #ifdef _WIN32 delete SystemTools::PathCaseMap; delete SystemTools::EnvMap; -#endif -#ifdef __CYGWIN__ - delete SystemTools::Cyg2Win32Map; #endif delete SystemTools::Statics; } diff --git a/SystemTools.hxx.in b/SystemTools.hxx.in index c35b023c53beed4c1b560b2cca069c4aa355f525..94fd8508d302e8203afbe3facc81b01c7085854a 100644 --- a/SystemTools.hxx.in +++ b/SystemTools.hxx.in @@ -999,9 +999,6 @@ private: static std::string GetActualCaseForPathCached(std::string const& path); static SystemToolsPathCaseMap* PathCaseMap; static SystemToolsEnvMap* EnvMap; -#endif -#ifdef __CYGWIN__ - static SystemToolsTranslationMap* Cyg2Win32Map; #endif static SystemToolsStatic* Statics; friend class SystemToolsManager;