Use better KWSys SystemTools::GetEnv and HasEnv signatures

This commit is contained in:
Dāvis Mosāns
2016-07-08 00:54:05 +03:00
committed by Brad King
parent 03407040d4
commit b1f87a50b3
24 changed files with 134 additions and 110 deletions
+4 -3
View File
@@ -31,13 +31,14 @@ bool cmSetCommand::InitialPass(std::vector<std::string> const& args,
putEnvArg += "=";
// what is the current value if any
const char* currValue = getenv(varName);
std::string currValue;
const bool currValueSet = cmSystemTools::GetEnv(varName, currValue);
delete[] varName;
// will it be set to something, then set it
if (args.size() > 1 && !args[1].empty()) {
// but only if it is different from current value
if (!currValue || strcmp(currValue, args[1].c_str())) {
if (!currValueSet || currValue != args[1]) {
putEnvArg += args[1];
cmSystemTools::PutEnv(putEnvArg);
}
@@ -45,7 +46,7 @@ bool cmSetCommand::InitialPass(std::vector<std::string> const& args,
}
// if it will be cleared, then clear it if it isn't already clear
if (currValue) {
if (currValueSet) {
cmSystemTools::PutEnv(putEnvArg);
}
return true;