X-Git-Url: http://git.treefish.org/~alex/phys/latlib.git/blobdiff_plain/b80a3fda9209144605a6306ba24ec2051d387f50..7f5403eed95da4350dcc03d817eb8468dab07142:/hypercache.cpp?ds=sidebyside diff --git a/hypercache.cpp b/hypercache.cpp index 16de2a2..b025ba6 100644 --- a/hypercache.cpp +++ b/hypercache.cpp @@ -5,7 +5,7 @@ configcache *hypercache::C = NULL; vector hypercache::delayedParaAdd; vector hypercache::delayedParaSet; string hypercache::activeCFile = ""; -vector hypercache::parentConfigs; +vector hypercache::parentConfigs; writeout *hypercache::out = NULL; void hypercache::initCache(configcache **cache, @@ -88,8 +88,10 @@ void hypercache::writeC() { } void hypercache::writeO() { - if ( activeCFile != "" ) - O->writeHeader("concurrent_cfile", activeCFile.c_str(), (activeCFile.length()+1)*sizeof(char)); + if ( activeCFile != "" ) { + unsigned long afilehash = configcache::hash(activeCFile); + O->writeHeader("concurrent_cfile", (char*)(&afilehash), sizeof(unsigned long)); + } O->writeConfig(); } @@ -98,7 +100,7 @@ bool hypercache::readO() { bool readret; if ( readret = O->readConfig() ) { - char *parentconfig = (char*)O->getHeader("concurrent_cfile"); + unsigned long *parentconfig = (unsigned long*)O->getHeader("concurrent_cfile"); if ( parentconfig != NULL ) addParentConfig(parentconfig); } @@ -106,10 +108,10 @@ bool hypercache::readO() { return readret; } -void hypercache::addParentConfig(const char* parentconfig) { - for (vector::iterator parit = parentConfigs.begin(); parit != parentConfigs.end(); ++parit) - if ( *parit == parentconfig ) +void hypercache::addParentConfig(const unsigned long *parentconfig) { + for (vector::iterator parit = parentConfigs.begin(); parit != parentConfigs.end(); ++parit) + if ( *parit == *parentconfig ) return; - parentConfigs.push_back(parentconfig); + parentConfigs.push_back(*parentconfig); }