From: Ilia Alshanetsky Date: Wed, 27 Oct 2004 23:12:05 +0000 (+0000) Subject: Simplify and cleanup code. X-Git-Tag: RELEASE_0_2~818 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=23344ea427af20300662f4294938e59717d73d0e;p=php Simplify and cleanup code. --- diff --git a/ext/standard/microtime.c b/ext/standard/microtime.c index a9e6d3bd09..fbf8e02500 100644 --- a/ext/standard/microtime.c +++ b/ext/standard/microtime.c @@ -107,20 +107,15 @@ PHP_FUNCTION(gettimeofday) Returns an array of usage statistics */ PHP_FUNCTION(getrusage) { - struct rusage usg; - int ac = ZEND_NUM_ARGS(); - pval **pwho; + struct rusage usg = {0}; + long pwho = 0; int who = RUSAGE_SELF; - if(ac == 1 && - zend_get_parameters_ex(ac, &pwho) != FAILURE) { - convert_to_long_ex(pwho); - if(Z_LVAL_PP(pwho) == 1) - who = RUSAGE_CHILDREN; + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &pwho) != FAILURE && pwho == 1) { + who = RUSAGE_CHILDREN; } - memset(&usg, 0, sizeof(usg)); - if(getrusage(who, &usg) == -1) { + if (getrusage(who, &usg) == -1) { RETURN_FALSE; }