From 9e93f5248116a2e1e49925649d5326be4bbf2155 Mon Sep 17 00:00:00 2001 From: Johann Dreo Date: Wed, 22 Dec 2010 18:29:30 +0100 Subject: [PATCH] const parameter + intermediate reused variable --- eo/src/eoEvalUserTimeThrowException.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/eo/src/eoEvalUserTimeThrowException.h b/eo/src/eoEvalUserTimeThrowException.h index d47c064a..57678d88 100644 --- a/eo/src/eoEvalUserTimeThrowException.h +++ b/eo/src/eoEvalUserTimeThrowException.h @@ -39,7 +39,7 @@ template< class EOT > class eoEvalUserTimeThrowException : public eoEvalFuncCounter< EOT > { public: - eoEvalUserTimeThrowException( eoEvalFunc & func, long max ) : _max(max), eoEvalFuncCounter( func, "CPU-user") {} + eoEvalUserTimeThrowException( eoEvalFunc & func, const long max ) : _max(max), eoEvalFuncCounter( func, "CPU-user") {} virtual void operator() ( EOT & eo ) { @@ -47,8 +47,9 @@ public: getrusage(RUSAGE_SELF,&_usage); - if( _usage.ru_utime.tv_sec >= _max ) { - throw eoMaxTimeException( _usage.ru_utime.tv_sec ); + long current = _usage.ru_utime.tv_sec; + if( current >= _max ) { + throw eoMaxTimeException( current ); } else { func(eo); } @@ -56,6 +57,6 @@ public: } protected: - long _max; + const long _max; struct rusage _usage; };