summaryrefslogtreecommitdiffstats
path: root/Glob.cxx
diff options
context:
space:
mode:
authorKWSys Robot <kwrobot@kitware.com>2014-05-07 20:31:11 (GMT)
committerBrad King <brad.king@kitware.com>2014-05-13 18:55:30 (GMT)
commit7762c57405d3b0daefc484a5e07bc24e04701615 (patch)
treed72b0bd5ff9ed61dff559414e0751a8bf9a80979 /Glob.cxx
parent397bccbaa94e6d17d15d17af2158fa6325d5c1e9 (diff)
downloadCMake-7762c57405d3b0daefc484a5e07bc24e04701615.zip
CMake-7762c57405d3b0daefc484a5e07bc24e04701615.tar.gz
CMake-7762c57405d3b0daefc484a5e07bc24e04701615.tar.bz2
KWSys 2014-05-07 (6074f33f)
Extract upstream KWSys using the following shell commands. $ git archive --prefix=upstream-kwsys/ 6074f33f | tar x $ git shortlog --no-merges --abbrev=8 --format='%h %s' f3a36760..6074f33f Ben Boeckel (22): ef3bfa01 c_str: Don't use .c_str() when streaming strings 9c165368 Glob: Use string comparisons if you have them ready 53ba0bc6 containers: Use .empty() instead of .size() where possible 6cbb57ac strings: Use string methods instead of size calculations e53596b7 RegularExpression: Add string overloads aec9de6a CommandLineArguments: Push the string back, not its C string 1d531416 Glob: Accept a string in Glob::AddFile 81f5e0a8 Glob: Accept a string in Glob::AddExpression d40c2706 SystemTools: Remove redundant if guards c1296f4a SystemTools: Defer computing length until after a .empty() check 7ffb7106 SystemTools: Use the iterator constructor for strings 29e3b1d8 SystemTools: Use .rfind('/') rather than .find_last_of("/") 5eb3a65c SystemTools: Don't construct a string just for its length b07b5fc1 SystemTools: Take a string in GetShortPath 153f6df7 SystemTools: Use strings in ComparePath 2c2f6604 SystemTools: Accept strings in IsSubDirectory 84db9ee5 SystemTools: Take strings in AddTranslationPath 4b409aa4 SystemTools: Take strings in SplitPath d2dbff07 SystemTools: Take strings in CollapseFullPath e9204f8f SystemTools: Take strings in AddKeepPath 3254681a SystemTools: Reserve memory in JoinPath 6074f33f SystemTools: Use static strings in SystemToolsAppendComponents Change-Id: I53c7a1005206dba43ee785bf807c478bf146ca0e
Diffstat (limited to 'Glob.cxx')
-rw-r--r--Glob.cxx31
1 files changed, 14 insertions, 17 deletions
diff --git a/Glob.cxx b/Glob.cxx
index 46a7e4f..8569b0e 100644
--- a/Glob.cxx
+++ b/Glob.cxx
@@ -229,8 +229,7 @@ void Glob::RecurseDirectory(kwsys_stl::string::size_type start,
for ( cc = 0; cc < d.GetNumberOfFiles(); cc ++ )
{
fname = d.GetFile(cc);
- if ( strcmp(fname.c_str(), ".") == 0 ||
- strcmp(fname.c_str(), "..") == 0 )
+ if ( fname == "." || fname == ".." )
{
continue;
}
@@ -271,11 +270,10 @@ void Glob::RecurseDirectory(kwsys_stl::string::size_type start,
}
else
{
- if ( (this->Internals->Expressions.size() > 0) &&
- this->Internals->Expressions[
- this->Internals->Expressions.size()-1].find(fname.c_str()) )
+ if ( !this->Internals->Expressions.empty() &&
+ this->Internals->Expressions.rbegin()->find(fname) )
{
- this->AddFile(this->Internals->Files, realname.c_str());
+ this->AddFile(this->Internals->Files, realname);
}
}
}
@@ -310,8 +308,7 @@ void Glob::ProcessDirectory(kwsys_stl::string::size_type start,
for ( cc = 0; cc < d.GetNumberOfFiles(); cc ++ )
{
fname = d.GetFile(cc);
- if ( strcmp(fname.c_str(), ".") == 0 ||
- strcmp(fname.c_str(), "..") == 0 )
+ if ( fname == "." || fname == ".." )
{
continue;
}
@@ -354,7 +351,7 @@ void Glob::ProcessDirectory(kwsys_stl::string::size_type start,
{
if ( last )
{
- this->AddFile(this->Internals->Files, realname.c_str());
+ this->AddFile(this->Internals->Files, realname);
}
else
{
@@ -442,9 +439,9 @@ bool Glob::FindFiles(const kwsys_stl::string& inexpr)
int ch = expr[cc];
if ( ch == '/' )
{
- if ( cexpr.size() > 0 )
+ if ( !cexpr.empty() )
{
- this->AddExpression(cexpr.c_str());
+ this->AddExpression(cexpr);
}
cexpr = "";
}
@@ -453,9 +450,9 @@ bool Glob::FindFiles(const kwsys_stl::string& inexpr)
cexpr.append(1, static_cast<char>(ch));
}
}
- if ( cexpr.size() > 0 )
+ if ( !cexpr.empty() )
{
- this->AddExpression(cexpr.c_str());
+ this->AddExpression(cexpr);
}
// Handle network paths
@@ -471,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)));
}
//----------------------------------------------------------------------------
@@ -500,11 +497,11 @@ const char* Glob::GetRelative()
}
//----------------------------------------------------------------------------
-void Glob::AddFile(kwsys_stl::vector<kwsys_stl::string>& files, const char* file)
+void Glob::AddFile(kwsys_stl::vector<kwsys_stl::string>& files, const kwsys_stl::string& file)
{
if ( !this->Relative.empty() )
{
- files.push_back(kwsys::SystemTools::RelativePath(this->Relative.c_str(), file));
+ files.push_back(kwsys::SystemTools::RelativePath(this->Relative.c_str(), file.c_str()));
}
else
{