diff options
author | Marc Chevrier <marc.chevrier@gmail.com> | 2023-05-28 14:27:03 (GMT) |
---|---|---|
committer | Marc Chevrier <marc.chevrier@gmail.com> | 2023-05-30 14:41:59 (GMT) |
commit | 4fc322bab421a83b12977aadc7dca247db8ae541 (patch) | |
tree | 3e57b548bd2326f3a848eb23ad66da33d28f60b5 /Source/cmMakefile.cxx | |
parent | b0d1ddb7234950374977b83f8dbded806c15b356 (diff) | |
download | CMake-4fc322bab421a83b12977aadc7dca247db8ae541.zip CMake-4fc322bab421a83b12977aadc7dca247db8ae541.tar.gz CMake-4fc322bab421a83b12977aadc7dca247db8ae541.tar.bz2 |
AddCacheEntry: Suppress raw pointer usage
Diffstat (limited to 'Source/cmMakefile.cxx')
-rw-r--r-- | Source/cmMakefile.cxx | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 585924d..4acb283 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1939,8 +1939,8 @@ void cmMakefile::AddDefinitionBool(const std::string& name, bool value) this->AddDefinition(name, value ? "ON" : "OFF"); } -void cmMakefile::AddCacheDefinition(const std::string& name, const char* value, - const char* doc, +void cmMakefile::AddCacheDefinition(const std::string& name, cmValue value, + cmValue doc, cmStateEnums::CacheEntryType type, bool force) { @@ -1954,22 +1954,20 @@ void cmMakefile::AddCacheDefinition(const std::string& name, const char* value, // if this is not a force, then use the value from the cache // if it is a force, then use the value being passed in if (!force) { - value = existingValue->c_str(); + value = existingValue; } if (type == cmStateEnums::PATH || type == cmStateEnums::FILEPATH) { - nvalue = value ? value : ""; - - cmList files(nvalue); + cmList files(value); for (auto& file : files) { if (!cmIsOff(file)) { file = cmSystemTools::CollapseFullPath(file); } } nvalue = files.to_string(); + value = cmValue{ nvalue }; - this->GetCMakeInstance()->AddCacheEntry(name, nvalue, doc, type); - nvalue = *this->GetState()->GetInitializedCacheValue(name); - value = nvalue.c_str(); + this->GetCMakeInstance()->AddCacheEntry(name, value, doc, type); + value = this->GetState()->GetInitializedCacheValue(name); } } this->GetCMakeInstance()->AddCacheEntry(name, value, doc, type); |