diff options
author | Vitaly Stakhovsky <vvs31415@gitlab.org> | 2020-03-13 17:30:00 (GMT) |
---|---|---|
committer | Vitaly Stakhovsky <vvs31415@gitlab.org> | 2020-03-13 17:32:17 (GMT) |
commit | 60f57d0dccb18bfcb37e6bd0c6496cc2e7996d14 (patch) | |
tree | 575fad8fdaf9dd42c0d88785a5aa6b361406fe80 /Source/cmSourceFile.cxx | |
parent | 3766633b8a49cb24f4849721bb22a0feb9ba1f60 (diff) | |
download | CMake-60f57d0dccb18bfcb37e6bd0c6496cc2e7996d14.zip CMake-60f57d0dccb18bfcb37e6bd0c6496cc2e7996d14.tar.gz CMake-60f57d0dccb18bfcb37e6bd0c6496cc2e7996d14.tar.bz2 |
cmPropertyMap: Introduce cmProp as return type for GetProperty() functions
Currently properties are usually stored internally as `std::string`.
However, family of GetProperty() functions return them as `const char *` using `c_str()`.
The proposed `cmProp`, typedef'ed as `const std::string *` will expose properties
more naturally.
Diffstat (limited to 'Source/cmSourceFile.cxx')
-rw-r--r-- | Source/cmSourceFile.cxx | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/Source/cmSourceFile.cxx b/Source/cmSourceFile.cxx index fd9cacd..5dc8b05 100644 --- a/Source/cmSourceFile.cxx +++ b/Source/cmSourceFile.cxx @@ -361,7 +361,7 @@ const char* cmSourceFile::GetProperty(const std::string& prop) const return output.c_str(); } - const char* retVal = this->Properties.GetPropertyValue(prop); + cmProp retVal = this->Properties.GetPropertyValue(prop); if (!retVal) { cmMakefile const* mf = this->Location.GetMakefile(); const bool chain = @@ -369,9 +369,10 @@ const char* cmSourceFile::GetProperty(const std::string& prop) const if (chain) { return mf->GetProperty(prop, chain); } + return nullptr; } - return retVal; + return retVal->c_str(); } const char* cmSourceFile::GetSafeProperty(const std::string& prop) const |