Skip to content
Snippets Groups Projects
Commit 1d531416 authored by Ben Boeckel's avatar Ben Boeckel
Browse files

Glob: Accept a string in Glob::AddFile

If Relative was non-empty, the parameter is unconditionally casted into
a string anyways, so save the allocation.

Change-Id: I835782fa0307c0122cacf032d4937b5646561d7f
parent aec9de6a
No related branches found
No related tags found
No related merge requests found
......@@ -273,7 +273,7 @@ void Glob::RecurseDirectory(kwsys_stl::string::size_type start,
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);
}
}
}
......@@ -351,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
{
......@@ -497,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
{
......
......@@ -94,7 +94,7 @@ protected:
void AddExpression(const char* expr);
//! Add a file to the list
void AddFile(kwsys_stl::vector<kwsys_stl::string>& files, const char* file);
void AddFile(kwsys_stl::vector<kwsys_stl::string>& files, const kwsys_stl::string& file);
GlobInternals* Internals;
bool Recurse;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment