cmMakefile: Convert filenametoread into a std::string.

Remove other intermediate variables.
This commit is contained in:
Stephen Kelly 2015-04-18 14:50:36 +02:00
parent e2d0e0fbeb
commit 5947d9b031
1 changed files with 9 additions and 11 deletions

View File

@ -542,34 +542,32 @@ bool cmMakefile::ReadListFile(const char* filename_in,
bool noPolicyScope, bool noPolicyScope,
bool requireProjectCommand) bool requireProjectCommand)
{ {
std::string external_abs; std::string filenametoread;
if (filename_in)
const char* filenametoread = filename_in; {
std::string filename_abs; filenametoread = filename_in;
}
if (external_in) if (external_in)
{ {
if (filename_in) if (filename_in)
{ {
filename_abs = filenametoread =
cmSystemTools::CollapseFullPath(filename_in, cmSystemTools::CollapseFullPath(filename_in,
this->cmStartDirectory.c_str()); this->cmStartDirectory.c_str());
filenametoread = filename_abs.c_str();
} }
} }
if (filenametoread) if (!filenametoread.empty())
{ {
this->cmCurrentListFile = filenametoread; this->cmCurrentListFile = filenametoread;
} }
if (external_in) if (external_in)
{ {
external_abs = filenametoread =
cmSystemTools::CollapseFullPath(external_in, cmSystemTools::CollapseFullPath(external_in,
this->cmStartDirectory.c_str()); this->cmStartDirectory.c_str());
filenametoread = external_abs.c_str();
} }
std::string currentParentFile std::string currentParentFile
@ -580,7 +578,7 @@ bool cmMakefile::ReadListFile(const char* filename_in,
this->AddDefinition("CMAKE_PARENT_LIST_FILE", filename_in); this->AddDefinition("CMAKE_PARENT_LIST_FILE", filename_in);
this->MarkVariableAsUsed("CMAKE_PARENT_LIST_FILE"); this->MarkVariableAsUsed("CMAKE_PARENT_LIST_FILE");
bool res = this->ReadListFileInternal(filenametoread, bool res = this->ReadListFileInternal(filenametoread.c_str(),
noPolicyScope, requireProjectCommand); noPolicyScope, requireProjectCommand);
this->AddDefinition("CMAKE_PARENT_LIST_FILE", currentParentFile.c_str()); this->AddDefinition("CMAKE_PARENT_LIST_FILE", currentParentFile.c_str());