From d2dbff07878b1488fd16f88b11b743791b769726 Mon Sep 17 00:00:00 2001
From: Ben Boeckel <mathstuf@gmail.com>
Date: Tue, 11 Mar 2014 13:24:11 -0400
Subject: [PATCH] SystemTools: Take strings in CollapseFullPath

Change-Id: Ieb7479b6cde5edebe0b6b4ec132d8dd7b413d039
---
 SystemTools.cxx    | 32 ++++++++++++++++----------------
 SystemTools.hxx.in |  4 ++--
 2 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/SystemTools.cxx b/SystemTools.cxx
index 7b29778..0564ee1 100644
--- a/SystemTools.cxx
+++ b/SystemTools.cxx
@@ -2536,7 +2536,7 @@ kwsys_stl::string SystemTools
   kwsys_stl::string tryPath = SystemTools::FindName(name, userPaths, no_system_path);
   if(tryPath != "" && !SystemTools::FileIsDirectory(tryPath.c_str()))
     {
-    return SystemTools::CollapseFullPath(tryPath.c_str());
+    return SystemTools::CollapseFullPath(tryPath);
     }
   // Couldn't find the file.
   return "";
@@ -2555,7 +2555,7 @@ kwsys_stl::string SystemTools
   kwsys_stl::string tryPath = SystemTools::FindName(name, userPaths, no_system_path);
   if(tryPath != "" && SystemTools::FileIsDirectory(tryPath.c_str()))
     {
-    return SystemTools::CollapseFullPath(tryPath.c_str());
+    return SystemTools::CollapseFullPath(tryPath);
     }
   // Couldn't find the file.
   return "";
@@ -2603,7 +2603,7 @@ kwsys_stl::string SystemTools::FindProgram(
     if(SystemTools::FileExists(tryPath.c_str()) &&
         !SystemTools::FileIsDirectory(tryPath.c_str()))
       {
-      return SystemTools::CollapseFullPath(tryPath.c_str());
+      return SystemTools::CollapseFullPath(tryPath);
       }
     }
   // now try just the name
@@ -2611,7 +2611,7 @@ kwsys_stl::string SystemTools::FindProgram(
   if(SystemTools::FileExists(tryPath.c_str()) &&
      !SystemTools::FileIsDirectory(tryPath.c_str()))
     {
-    return SystemTools::CollapseFullPath(tryPath.c_str());
+    return SystemTools::CollapseFullPath(tryPath);
     }
   // now construct the path
   kwsys_stl::vector<kwsys_stl::string> path;
@@ -2658,7 +2658,7 @@ kwsys_stl::string SystemTools::FindProgram(
       if(SystemTools::FileExists(tryPath.c_str()) &&
           !SystemTools::FileIsDirectory(tryPath.c_str()))
         {
-        return SystemTools::CollapseFullPath(tryPath.c_str());
+        return SystemTools::CollapseFullPath(tryPath);
         }
       }
     // now try it without them
@@ -2667,7 +2667,7 @@ kwsys_stl::string SystemTools::FindProgram(
     if(SystemTools::FileExists(tryPath.c_str()) &&
        !SystemTools::FileIsDirectory(tryPath.c_str()))
       {
-      return SystemTools::CollapseFullPath(tryPath.c_str());
+      return SystemTools::CollapseFullPath(tryPath);
       }
     }
   // Couldn't find the program.
@@ -2744,7 +2744,7 @@ kwsys_stl::string SystemTools
     if(SystemTools::FileExists(tryPath.c_str())
        && SystemTools::FileIsDirectory(tryPath.c_str()))
       {
-      return SystemTools::CollapseFullPath(tryPath.c_str());
+      return SystemTools::CollapseFullPath(tryPath);
       }
 #endif
 #if defined(_WIN32) && !defined(__CYGWIN__) && !defined(__MINGW32__)
@@ -2754,7 +2754,7 @@ kwsys_stl::string SystemTools
     if(SystemTools::FileExists(tryPath.c_str())
        && !SystemTools::FileIsDirectory(tryPath.c_str()))
       {
-      return SystemTools::CollapseFullPath(tryPath.c_str());
+      return SystemTools::CollapseFullPath(tryPath);
       }
 #else
     tryPath = *p;
@@ -2764,7 +2764,7 @@ kwsys_stl::string SystemTools
     if(SystemTools::FileExists(tryPath.c_str())
        && !SystemTools::FileIsDirectory(tryPath.c_str()))
       {
-      return SystemTools::CollapseFullPath(tryPath.c_str());
+      return SystemTools::CollapseFullPath(tryPath);
       }
     tryPath = *p;
     tryPath += "lib";
@@ -2773,7 +2773,7 @@ kwsys_stl::string SystemTools
     if(SystemTools::FileExists(tryPath.c_str())
        && !SystemTools::FileIsDirectory(tryPath.c_str()))
       {
-      return SystemTools::CollapseFullPath(tryPath.c_str());
+      return SystemTools::CollapseFullPath(tryPath);
       }
     tryPath = *p;
     tryPath += "lib";
@@ -2782,7 +2782,7 @@ kwsys_stl::string SystemTools
     if(SystemTools::FileExists(tryPath.c_str())
        && !SystemTools::FileIsDirectory(tryPath.c_str()))
       {
-      return SystemTools::CollapseFullPath(tryPath.c_str());
+      return SystemTools::CollapseFullPath(tryPath);
       }
     tryPath = *p;
     tryPath += "lib";
@@ -2791,7 +2791,7 @@ kwsys_stl::string SystemTools
     if(SystemTools::FileExists(tryPath.c_str())
        && !SystemTools::FileIsDirectory(tryPath.c_str()))
       {
-      return SystemTools::CollapseFullPath(tryPath.c_str());
+      return SystemTools::CollapseFullPath(tryPath);
       }
     tryPath = *p;
     tryPath += "lib";
@@ -2800,7 +2800,7 @@ kwsys_stl::string SystemTools
     if(SystemTools::FileExists(tryPath.c_str())
        && !SystemTools::FileIsDirectory(tryPath.c_str()))
       {
-      return SystemTools::CollapseFullPath(tryPath.c_str());
+      return SystemTools::CollapseFullPath(tryPath);
       }
 #endif
     }
@@ -2935,7 +2935,7 @@ kwsys_stl::string SystemTools::GetCurrentWorkingDirectory(bool collapse)
     }
   if(collapse)
     {
-    return SystemTools::CollapseFullPath(path.c_str());
+    return SystemTools::CollapseFullPath(path);
     }
   return path;
 }
@@ -3046,7 +3046,7 @@ bool SystemTools::FindProgramPath(const char* argv0,
 }
 
 
-kwsys_stl::string SystemTools::CollapseFullPath(const char* in_relative)
+kwsys_stl::string SystemTools::CollapseFullPath(const kwsys_stl::string& in_relative)
 {
   return SystemTools::CollapseFullPath(in_relative, 0);
 }
@@ -3147,7 +3147,7 @@ SystemToolsAppendComponents(
     }
 }
 
-kwsys_stl::string SystemTools::CollapseFullPath(const char* in_path,
+kwsys_stl::string SystemTools::CollapseFullPath(const kwsys_stl::string& in_path,
                                                 const char* in_base)
 {
   // Collect the output path components.
diff --git a/SystemTools.hxx.in b/SystemTools.hxx.in
index e4244b7..41069a9 100644
--- a/SystemTools.hxx.in
+++ b/SystemTools.hxx.in
@@ -357,8 +357,8 @@ public:
    * (which defaults to the current working directory).  The full path
    * is returned.
    */
-  static kwsys_stl::string CollapseFullPath(const char* in_relative);
-  static kwsys_stl::string CollapseFullPath(const char* in_relative,
+  static kwsys_stl::string CollapseFullPath(const kwsys_stl::string& in_relative);
+  static kwsys_stl::string CollapseFullPath(const kwsys_stl::string& in_relative,
                                             const char* in_base);
 
   /** 
-- 
GitLab