From 6470ee1a051a4e4fac014162c0d9632487093d08 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Tue, 5 Jan 2010 00:17:29 +0000 Subject: Removed some silly debugging output and added the StatCache, it turns out this doesn't matter, at least on linux...but...it's a nice idea? I dunno. --- src/conditionfiletime.cpp | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'src/conditionfiletime.cpp') diff --git a/src/conditionfiletime.cpp b/src/conditionfiletime.cpp index 148ffac..abcb3f3 100644 --- a/src/conditionfiletime.cpp +++ b/src/conditionfiletime.cpp @@ -4,6 +4,7 @@ #include #include #include +#include "statcache.h" #include using namespace Bu; @@ -18,6 +19,7 @@ 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 ) ) @@ -30,22 +32,20 @@ bool ConditionFileTime::shouldExec( class Runner &r, Target &rTarget ) } } - time_t tOut = 0; - struct stat s; + time_t tOut = 0, tmp; for( StrList::const_iterator j = rTarget.getOutputList().begin(); j; j++ ) { - stat( (*j).getStr(), &s ); - if( tOut == 0 || tOut > s.st_mtime ) + tmp = Stat.mtime( *j ); + if( tOut == 0 || tOut > tmp ) { - tOut = s.st_mtime; + tOut = tmp; } } for( StrList::const_iterator j = rTarget.getInputList().begin(); j; j++ ) { - stat( (*j).getStr(), &s ); - if( tOut < s.st_mtime ) + if( tOut < Stat.mtime( *j ) ) { //sio << "-- Target processed because '" << *j // << "' is newer than output." << sio.nl; @@ -57,8 +57,7 @@ bool ConditionFileTime::shouldExec( class Runner &r, Target &rTarget ) for( StrList::const_iterator j = rTarget.getRequiresList().begin(); j; j++ ) { - stat( (*j).getStr(), &s ); - if( tOut < s.st_mtime ) + if( tOut < Stat.mtime( *j ) ) { //sio << "-- Target processed because '" << *j // << "' is newer than output." << sio.nl; -- cgit v1.2.3