Re: cvs: php4 /ext/pcntl pcntl.c

From: Date: Wed, 24 Apr 2002 05:39:26 +0000
Subject: Re: cvs: php4 /ext/pcntl pcntl.c
References: 1 2  Groups: php.cvs 
Request: Send a blank email to php-cvs+get-11381@lists.php.net to get a copy of this message
Hi, as Andrei said once, it's useful but doesn't cure all ills. Personally I've to say I'm more comfortable with zend_parse_parameters() and it makes the code much more readable. I hope you don't mind the mixed function call styles in the file (I found it needless to convert the whole file now for only that fix). regards, - Markus On Tue, Apr 23, 2002 at 11:03:50PM -0500, Jason Greene wrote : > Thanks for the fix > > I have been meaning to switch everything to parse params, (just not > enough time) > > Thanks, > Jason > > On Tue, 2002-04-23 at 16:21, Markus Fischer wrote: > > mfischer Tue Apr 23 17:21:41 2002 EDT > > > > Modified files: > > /php4/ext/pcntl pcntl.c > > Log: > > - Fix pcntl_waitpid() [Fixes #16766]. > > > > > > Index: php4/ext/pcntl/pcntl.c > > diff -u php4/ext/pcntl/pcntl.c:1.23 php4/ext/pcntl/pcntl.c:1.24 > > --- php4/ext/pcntl/pcntl.c:1.23 Sun Mar 17 14:41:24 2002 > > +++ php4/ext/pcntl/pcntl.c Tue Apr 23 17:21:41 2002 > > @@ -16,7 +16,7 @@ > > +----------------------------------------------------------------------+ > > */ > > > > -/* $Id: pcntl.c,v 1.23 2002/03/17 19:41:24 jason Exp $ */ > > +/* $Id: pcntl.c,v 1.24 2002/04/23 21:21:41 mfischer Exp $ */ > > > > #define PCNTL_DEBUG 0 > > > > @@ -220,27 +220,21 @@ > > Waits on or returns the status of a forked child as defined by the waitpid() system > > call */ > > PHP_FUNCTION(pcntl_waitpid) > > { > > - zval **pid, **status, **options; > > - int temp_options, temp_status = 0; > > - pid_t temp_id; > > + long pid, options = 0; > > + zval *z_status = NULL; > > + int status; > > + pid_t child_id; > > > > - if (ZEND_NUM_ARGS() > 3 || ZEND_NUM_ARGS() < 2 || > > zend_get_parameters_ex(ZEND_NUM_ARGS(), &pid, &status, &options) == FAILURE) { > > - WRONG_PARAM_COUNT; > > - } > > + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lz|l", &pid, > > &z_status, &options) == FAILURE) > > + return; > > > > - convert_to_long_ex(pid); > > - convert_to_long_ex(options); > > - convert_to_long_ex(status); > > - > > - if (ZEND_NUM_ARGS() == 2) { > > - temp_options = 0; > > - } else { > > - temp_options = Z_LVAL_PP(options); > > - } > > - > > - temp_id = waitpid((pid_t) Z_LVAL_PP(pid), &temp_status, temp_options); > > - Z_LVAL_PP(status) = temp_status; > > - RETURN_LONG((long) temp_id); > > + status = Z_LVAL_P(z_status); > > + > > + child_id = waitpid((pid_t) pid, &status, options); > > + > > + Z_LVAL_P(z_status) = status; > > + > > + RETURN_LONG((long) child_id); > > } > > /* }}} */ > > > > > > > > > > -- > > PHP CVS Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > -- Please always Cc to me when replying to me on the lists. GnuPG Key: http://guru.josefine.at/~mfischer/C2272BD0.asc "Mind if I MFH ?" "What QA did you do on it?" "the usual?" "ah... none :)"

« previous php.cvs (#11381) next »