summaryrefslogtreecommitdiffstats
path: root/Source/cmIfCommand.cxx
diff options
context:
space:
mode:
authorBen Boeckel <ben.boeckel@kitware.com>2014-02-04 21:06:56 (GMT)
committerBrad King <brad.king@kitware.com>2014-03-08 18:05:28 (GMT)
commit3742bb0d324b971f63cc7e557b1cb8a9d08c5cdd (patch)
tree0259dae54801daae0f5823e335cc6b608328623d /Source/cmIfCommand.cxx
parentec97ed7d0c67b635caf3ada65541b2eaf0818a93 (diff)
downloadCMake-3742bb0d324b971f63cc7e557b1cb8a9d08c5cdd.zip
CMake-3742bb0d324b971f63cc7e557b1cb8a9d08c5cdd.tar.gz
CMake-3742bb0d324b971f63cc7e557b1cb8a9d08c5cdd.tar.bz2
stringapi: Use strings for variable names
Variable names are always generated by CMake and should never be NULL.
Diffstat (limited to 'Source/cmIfCommand.cxx')
-rw-r--r--Source/cmIfCommand.cxx18
1 files changed, 9 insertions, 9 deletions
diff --git a/Source/cmIfCommand.cxx b/Source/cmIfCommand.cxx
index ee95c05..bd12327 100644
--- a/Source/cmIfCommand.cxx
+++ b/Source/cmIfCommand.cxx
@@ -593,7 +593,7 @@ namespace
if (argP1 != newArgs.end() && argP2 != newArgs.end() &&
*(argP1) == "MATCHES")
{
- def = cmIfCommand::GetVariableOrString(arg->c_str(), makefile);
+ def = cmIfCommand::GetVariableOrString(*arg, makefile);
const char* rex = (argP2)->c_str();
cmStringCommand::ClearMatches(makefile);
cmsys::RegularExpression regEntry;
@@ -634,8 +634,8 @@ namespace
(*(argP1) == "LESS" || *(argP1) == "GREATER" ||
*(argP1) == "EQUAL"))
{
- def = cmIfCommand::GetVariableOrString(arg->c_str(), makefile);
- def2 = cmIfCommand::GetVariableOrString((argP2)->c_str(), makefile);
+ def = cmIfCommand::GetVariableOrString(*arg, makefile);
+ def2 = cmIfCommand::GetVariableOrString(*argP2, makefile);
double lhs;
double rhs;
bool result;
@@ -665,8 +665,8 @@ namespace
*(argP1) == "STREQUAL" ||
*(argP1) == "STRGREATER"))
{
- def = cmIfCommand::GetVariableOrString(arg->c_str(), makefile);
- def2 = cmIfCommand::GetVariableOrString((argP2)->c_str(), makefile);
+ def = cmIfCommand::GetVariableOrString(*arg, makefile);
+ def2 = cmIfCommand::GetVariableOrString(*argP2, makefile);
int val = strcmp(def,def2);
bool result;
if (*(argP1) == "STRLESS")
@@ -689,8 +689,8 @@ namespace
(*(argP1) == "VERSION_LESS" || *(argP1) == "VERSION_GREATER" ||
*(argP1) == "VERSION_EQUAL"))
{
- def = cmIfCommand::GetVariableOrString(arg->c_str(), makefile);
- def2 = cmIfCommand::GetVariableOrString((argP2)->c_str(), makefile);
+ def = cmIfCommand::GetVariableOrString(*arg, makefile);
+ def2 = cmIfCommand::GetVariableOrString(*argP2, makefile);
cmSystemTools::CompareOp op = cmSystemTools::OP_EQUAL;
if(*argP1 == "VERSION_LESS")
{
@@ -907,13 +907,13 @@ bool cmIfCommand::IsTrue(const std::vector<std::string> &args,
}
//=========================================================================
-const char* cmIfCommand::GetVariableOrString(const char* str,
+const char* cmIfCommand::GetVariableOrString(const std::string& str,
const cmMakefile* mf)
{
const char* def = mf->GetDefinition(str);
if(!def)
{
- def = str;
+ def = str.c_str();
}
return def;
}