Commit 507fc6c3 authored by Bill Hoffman's avatar Bill Hoffman
Browse files

ENH: performance improvments

parent e953531e
...@@ -2652,11 +2652,6 @@ int OldWindowsGetLongPath(kwsys_stl::string const& shortPath, ...@@ -2652,11 +2652,6 @@ int OldWindowsGetLongPath(kwsys_stl::string const& shortPath,
int PortableGetLongPathName(const char* pathIn, int PortableGetLongPathName(const char* pathIn,
kwsys_stl::string & longPath) kwsys_stl::string & longPath)
{ {
kwsys_stl::string shortPath;
if(!SystemTools::GetShortPath(pathIn, shortPath))
{
return 0;
}
HMODULE lh = LoadLibrary("Kernel32.dll"); HMODULE lh = LoadLibrary("Kernel32.dll");
if(lh) if(lh)
{ {
...@@ -2666,7 +2661,7 @@ int PortableGetLongPathName(const char* pathIn, ...@@ -2666,7 +2661,7 @@ int PortableGetLongPathName(const char* pathIn,
typedef DWORD (WINAPI * GetLongFunctionPtr) (LPCSTR,LPSTR,DWORD); typedef DWORD (WINAPI * GetLongFunctionPtr) (LPCSTR,LPSTR,DWORD);
GetLongFunctionPtr func = (GetLongFunctionPtr)proc; GetLongFunctionPtr func = (GetLongFunctionPtr)proc;
char buffer[MAX_PATH+1]; char buffer[MAX_PATH+1];
int len = (*func)(shortPath.c_str(), buffer, MAX_PATH+1); int len = (*func)(pathIn, buffer, MAX_PATH+1);
if(len == 0 || len > MAX_PATH+1) if(len == 0 || len > MAX_PATH+1)
{ {
FreeLibrary(lh); FreeLibrary(lh);
...@@ -2678,7 +2673,7 @@ int PortableGetLongPathName(const char* pathIn, ...@@ -2678,7 +2673,7 @@ int PortableGetLongPathName(const char* pathIn,
} }
FreeLibrary(lh); FreeLibrary(lh);
} }
return OldWindowsGetLongPath(shortPath.c_str(), longPath); return OldWindowsGetLongPath(pathIn, longPath);
} }
#endif #endif
...@@ -2790,7 +2785,11 @@ SystemTools::JoinPath(const kwsys_stl::vector<kwsys_stl::string>& components) ...@@ -2790,7 +2785,11 @@ SystemTools::JoinPath(const kwsys_stl::vector<kwsys_stl::string>& components)
bool SystemTools::ComparePath(const char* c1, const char* c2) bool SystemTools::ComparePath(const char* c1, const char* c2)
{ {
#if defined(_WIN32) || defined(__APPLE__) #if defined(_WIN32) || defined(__APPLE__)
return SystemTools::Strucmp(c1, c2) == 0; # ifdef _MSC_VER
return _stricmp(c1, c2) == 0;
# elif defined(__APPLE__) || defined(__GNUC__)
return strcasecmp(c1, c2) == 0;
# endif
#else #else
return strcmp(c1, c2) == 0; return strcmp(c1, c2) == 0;
#endif #endif
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment