From 81f5e0a8434b86936ca2dce761f31c7c839f7e31 Mon Sep 17 00:00:00 2001
From: Ben Boeckel <ben.boeckel@kitware.com>
Date: Sat, 8 Feb 2014 03:46:05 -0500
Subject: [PATCH] Glob: Accept a string in Glob::AddExpression

Change-Id: I5fc21da7073177768088a7298d84632c43f70bd6
---
 Glob.cxx    | 8 ++++----
 Glob.hxx.in | 2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/Glob.cxx b/Glob.cxx
index ef35a40..8569b0e 100644
--- a/Glob.cxx
+++ b/Glob.cxx
@@ -441,7 +441,7 @@ bool Glob::FindFiles(const kwsys_stl::string& inexpr)
       {
       if ( !cexpr.empty() )
         {
-        this->AddExpression(cexpr.c_str());
+        this->AddExpression(cexpr);
         }
       cexpr = "";
       }
@@ -452,7 +452,7 @@ bool Glob::FindFiles(const kwsys_stl::string& inexpr)
     }
   if ( !cexpr.empty() )
     {
-    this->AddExpression(cexpr.c_str());
+    this->AddExpression(cexpr);
     }
 
   // Handle network paths
@@ -468,11 +468,11 @@ bool Glob::FindFiles(const kwsys_stl::string& inexpr)
 }
 
 //----------------------------------------------------------------------------
-void Glob::AddExpression(const char* expr)
+void Glob::AddExpression(const kwsys_stl::string& expr)
 {
   this->Internals->Expressions.push_back(
     kwsys::RegularExpression(
-      this->PatternToRegex(expr).c_str()));
+      this->PatternToRegex(expr)));
 }
 
 //----------------------------------------------------------------------------
diff --git a/Glob.hxx.in b/Glob.hxx.in
index 806c680..d8b8491 100644
--- a/Glob.hxx.in
+++ b/Glob.hxx.in
@@ -91,7 +91,7 @@ protected:
     const kwsys_stl::string& dir);
 
   //! Add regular expression
-  void AddExpression(const char* expr);
+  void AddExpression(const kwsys_stl::string& expr);
 
   //! Add a file to the list
   void AddFile(kwsys_stl::vector<kwsys_stl::string>& files, const kwsys_stl::string& file);
-- 
GitLab