[cmake-commits] hoffman committed SystemTools.cxx 1.202 1.203 SystemTools.hxx.in 1.65 1.66

cmake-commits at cmake.org cmake-commits at cmake.org
Tue Oct 2 15:48:23 EDT 2007


Update of /cvsroot/CMake/CMake/Source/kwsys
In directory public:/mounts/ram/cvs-serv30923

Modified Files:
	SystemTools.cxx SystemTools.hxx.in 
Log Message:
ENH: speed up actual path name by cache on windows


Index: SystemTools.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/kwsys/SystemTools.cxx,v
retrieving revision 1.202
retrieving revision 1.203
diff -u -d -r1.202 -r1.203
--- SystemTools.cxx	20 Sep 2007 13:36:30 -0000	1.202
+++ SystemTools.cxx	2 Oct 2007 19:48:21 -0000	1.203
@@ -1464,7 +1464,8 @@
   // make it big enough for all of path and double quotes
   ret.reserve(strlen(path)+3);
   // put path into the string
-  ret.insert(0,path);
+  ret.assign(path);
+  ret = path;
   kwsys_stl::string::size_type pos = 0;
   // first convert all of the slashes
   while((pos = ret.find('/', pos)) != kwsys_stl::string::npos)
@@ -2879,6 +2880,14 @@
 #ifndef _WIN32
   return p;
 #else
+  // Check to see if actual case has already been called
+  // for this path, and the result is stored in the LongPathMap
+  SystemToolsTranslationMap::iterator i = 
+    SystemTools::LongPathMap->find(p);
+  if(i != SystemTools::LongPathMap->end())
+    {
+    return i->second;
+    }
   kwsys_stl::string shortPath;
   if(!SystemTools::GetShortPath(p, shortPath))
     {
@@ -2895,6 +2904,7 @@
     {
     longPath[0] = toupper(longPath[0]);
     }
+  (*SystemTools::LongPathMap)[p] = longPath;
   return longPath;
 #endif  
 }
@@ -4192,6 +4202,7 @@
 // necessary.
 unsigned int SystemToolsManagerCount;
 SystemToolsTranslationMap *SystemTools::TranslationMap;
+SystemToolsTranslationMap *SystemTools::LongPathMap;
 
 // SystemToolsManager manages the SystemTools singleton.
 // SystemToolsManager should be included in any translation unit
@@ -4219,6 +4230,7 @@
 {
   // Allocate the translation map first.
   SystemTools::TranslationMap = new SystemToolsTranslationMap;
+  SystemTools::LongPathMap = new SystemToolsTranslationMap;
 
   // Add some special translation paths for unix.  These are not added
   // for windows because drive letters need to be maintained.  Also,
@@ -4274,6 +4286,7 @@
 void SystemTools::ClassFinalize()
 {
   delete SystemTools::TranslationMap;
+  delete SystemTools::LongPathMap;
 }
 
 

Index: SystemTools.hxx.in
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/kwsys/SystemTools.hxx.in,v
retrieving revision 1.65
retrieving revision 1.66
diff -u -d -r1.65 -r1.66
--- SystemTools.hxx.in	12 Mar 2007 17:50:28 -0000	1.65
+++ SystemTools.hxx.in	2 Oct 2007 19:48:21 -0000	1.66
@@ -813,6 +813,7 @@
    * Each time 'dir' will be found it will be replace by 'refdir'
    */
   static SystemToolsTranslationMap *TranslationMap;
+  static SystemToolsTranslationMap *LongPathMap;
   friend class SystemToolsManager;
 };
 



More information about the Cmake-commits mailing list