From e809677b1d5a02b93a0be7a9fce8a6b67d0d91be Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Tue, 5 Jan 2010 00:22:20 +0000 Subject: Turns out the statcache broke other things, and didn't help at all. It's dead now... --- src/conditionfiletime.cpp | 17 +++++++++-------- src/statcache.cpp | 28 ---------------------------- src/statcache.h | 24 ------------------------ 3 files changed, 9 insertions(+), 60 deletions(-) delete mode 100644 src/statcache.cpp delete mode 100644 src/statcache.h diff --git a/src/conditionfiletime.cpp b/src/conditionfiletime.cpp index abcb3f3..148ffac 100644 --- a/src/conditionfiletime.cpp +++ b/src/conditionfiletime.cpp @@ -4,7 +4,6 @@ #include #include #include -#include "statcache.h" #include using namespace Bu; @@ -19,7 +18,6 @@ ConditionFileTime::~ConditionFileTime() bool ConditionFileTime::shouldExec( class Runner &r, Target &rTarget ) { - StatCache &Stat = StatCache::getInstance(); for( StrList::const_iterator j = rTarget.getOutputList().begin(); j; j++ ) { if( access( (*j).getStr(), F_OK ) ) @@ -32,20 +30,22 @@ bool ConditionFileTime::shouldExec( class Runner &r, Target &rTarget ) } } - time_t tOut = 0, tmp; + time_t tOut = 0; + struct stat s; for( StrList::const_iterator j = rTarget.getOutputList().begin(); j; j++ ) { - tmp = Stat.mtime( *j ); - if( tOut == 0 || tOut > tmp ) + stat( (*j).getStr(), &s ); + if( tOut == 0 || tOut > s.st_mtime ) { - tOut = tmp; + tOut = s.st_mtime; } } for( StrList::const_iterator j = rTarget.getInputList().begin(); j; j++ ) { - if( tOut < Stat.mtime( *j ) ) + stat( (*j).getStr(), &s ); + if( tOut < s.st_mtime ) { //sio << "-- Target processed because '" << *j // << "' is newer than output." << sio.nl; @@ -57,7 +57,8 @@ bool ConditionFileTime::shouldExec( class Runner &r, Target &rTarget ) for( StrList::const_iterator j = rTarget.getRequiresList().begin(); j; j++ ) { - if( tOut < Stat.mtime( *j ) ) + stat( (*j).getStr(), &s ); + if( tOut < s.st_mtime ) { //sio << "-- Target processed because '" << *j // << "' is newer than output." << sio.nl; diff --git a/src/statcache.cpp b/src/statcache.cpp deleted file mode 100644 index 3f5c21f..0000000 --- a/src/statcache.cpp +++ /dev/null @@ -1,28 +0,0 @@ -#include "statcache.h" - -#include - -#include - -StatCache::StatCache() -{ -} - -StatCache::~StatCache() -{ -} - -time_t StatCache::mtime( const Bu::FString &sFileName ) -{ - try - { - return hMTime.get( sFileName ); - } catch( ... ) - { - struct stat s; - stat( sFileName.getStr(), &s ); - hMTime.insert( sFileName, s.st_mtime ); - return s.st_mtime; - } -} - diff --git a/src/statcache.h b/src/statcache.h deleted file mode 100644 index e081ec3..0000000 --- a/src/statcache.h +++ /dev/null @@ -1,24 +0,0 @@ -#ifndef STAT_CACHE_H -#define STAT_CACHE_H - -#include -#include -#include -#include - -class StatCache : public Bu::Singleton -{ -friend class Bu::Singleton; -private: - StatCache(); - virtual ~StatCache(); - -public: - time_t mtime( const Bu::FString &sFileName ); - -private: - typedef Bu::Hash TimeHash; - TimeHash hMTime; -}; - -#endif -- cgit v1.2.3