summaryrefslogtreecommitdiffstats
path: root/Source/cmCacheManager.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2015-04-07 21:14:41 (GMT)
committerBrad King <brad.king@kitware.com>2015-04-07 21:15:04 (GMT)
commit3347c5e4f9fcdd36c06067d6c7cd5a985a9c5d94 (patch)
treed0372265c5b1f07f9b1a8a6cc9bedf96bed2dbcb /Source/cmCacheManager.cxx
parent9410e24a4ad3a21b2c27d057798f723e88d14d45 (diff)
downloadCMake-3347c5e4f9fcdd36c06067d6c7cd5a985a9c5d94.zip
CMake-3347c5e4f9fcdd36c06067d6c7cd5a985a9c5d94.tar.gz
CMake-3347c5e4f9fcdd36c06067d6c7cd5a985a9c5d94.tar.bz2
Revert topic 'refactor-cache-api'
This topic was never tested without some follow-up commits. The GetCacheEntryValue API returns a pointer to memory freed on return. It will have to be revised along with the rest of the original topic.
Diffstat (limited to 'Source/cmCacheManager.cxx')
-rw-r--r--Source/cmCacheManager.cxx16
1 files changed, 6 insertions, 10 deletions
diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx
index f8f2dbd..fa7eff3 100644
--- a/Source/cmCacheManager.cxx
+++ b/Source/cmCacheManager.cxx
@@ -284,16 +284,14 @@ bool cmCacheManager::LoadCache(const std::string& path,
}
this->CacheMajorVersion = 0;
this->CacheMinorVersion = 0;
- if(const char* cmajor =
- this->GetInitializedCacheValue("CMAKE_CACHE_MAJOR_VERSION"))
+ if(const char* cmajor = this->GetCacheValue("CMAKE_CACHE_MAJOR_VERSION"))
{
unsigned int v=0;
if(sscanf(cmajor, "%u", &v) == 1)
{
this->CacheMajorVersion = v;
}
- if(const char* cminor =
- this->GetInitializedCacheValue("CMAKE_CACHE_MINOR_VERSION"))
+ if(const char* cminor = this->GetCacheValue("CMAKE_CACHE_MINOR_VERSION"))
{
if(sscanf(cminor, "%u", &v) == 1)
{
@@ -315,11 +313,10 @@ bool cmCacheManager::LoadCache(const std::string& path,
}
// check to make sure the cache directory has not
// been moved
- const char* oldDir = this->GetInitializedCacheValue("CMAKE_CACHEFILE_DIR");
- if (internal && oldDir)
+ if ( internal && this->GetCacheValue("CMAKE_CACHEFILE_DIR") )
{
std::string currentcwd = path;
- std::string oldcwd = oldDir;
+ std::string oldcwd = this->GetCacheValue("CMAKE_CACHEFILE_DIR");
cmSystemTools::ConvertToUnixSlashes(currentcwd);
currentcwd += "/CMakeCache.txt";
oldcwd += "/CMakeCache.txt";
@@ -328,7 +325,7 @@ bool cmCacheManager::LoadCache(const std::string& path,
std::string message =
std::string("The current CMakeCache.txt directory ") +
currentcwd + std::string(" is different than the directory ") +
- std::string(this->GetInitializedCacheValue("CMAKE_CACHEFILE_DIR")) +
+ std::string(this->GetCacheValue("CMAKE_CACHEFILE_DIR")) +
std::string(" where CMakeCache.txt was created. This may result "
"in binaries being created in the wrong place. If you "
"are not sure, reedit the CMakeCache.txt");
@@ -658,8 +655,7 @@ cmCacheManager::CacheIterator cmCacheManager::GetCacheIterator(
return CacheIterator(*this, key);
}
-const char*
-cmCacheManager::GetInitializedCacheValue(const std::string& key) const
+const char* cmCacheManager::GetCacheValue(const std::string& key) const
{
CacheEntryMap::const_iterator i = this->Cache.find(key);
if(i != this->Cache.end() &&