Re: [ZEND-ENGINE-CVS] cvs: ZendEngine2 / zend_execute_API.c
| From: | Sterling Hughes | Date: | Sun, 18 Jul 2004 17:39:41 +0000 |
| Subject: | Re: [ZEND-ENGINE-CVS] cvs: ZendEngine2 / zend_execute_API.c | ||
| References: | 1 | Groups: | php.zend-engine.cvs |
| Request: | Send a blank email to php-zend-engine-cvs+get-2760@lists.php.net to get a copy of this message | ||
what prompted this code change?
On Sun, 18 Jul 2004 09:55:02 -0000, Wez Furlong <wez@php.net> wrote:
> wez Sun Jul 18 05:55:02 2004 EDT
>
> Modified files:
> /ZendEngine2 zend_execute_API.c
> Log:
> No point allocating 0 bytes
>
>
> http://cvs.php.net/diff.php/ZendEngine2/zend_execute_API.c?r1=1.287&r2=1.288&ty=u
> Index: ZendEngine2/zend_execute_API.c
> diff -u ZendEngine2/zend_execute_API.c:1.287 ZendEngine2/zend_execute_API.c:1.288
> --- ZendEngine2/zend_execute_API.c:1.287 Tue May 18 16:14:54 2004
> +++ ZendEngine2/zend_execute_API.c Sun Jul 18 05:55:02 2004
> @@ -17,7 +17,7 @@
> +----------------------------------------------------------------------+
> */
>
> -/* $Id: zend_execute_API.c,v 1.287 2004/05/18 20:14:54 wez Exp $ */
> +/* $Id: zend_execute_API.c,v 1.288 2004/07/18 09:55:02 wez Exp $ */
>
> #include <stdio.h>
> #include <signal.h>
> @@ -514,13 +514,18 @@
>
> int call_user_function(HashTable *function_table, zval **object_pp, zval *function_name, zval
> *retval_ptr, zend_uint param_count, zval *params[] TSRMLS_DC)
> {
> - zval ***params_array = (zval ***) emalloc(sizeof(zval **)*param_count);
> + zval ***params_array;
> zend_uint i;
> int ex_retval;
> zval *local_retval_ptr;
>
> - for (i=0; i<param_count; i++) {
> - params_array[i] = ¶ms[i];
> + if (param_count) {
> + params_array = (zval ***) emalloc(sizeof(zval **)*param_count);
> + for (i=0; i<param_count; i++) {
> + params_array[i] = ¶ms[i];
> + }
> + } else {
> + params_array = NULL;
> }
> ex_retval = call_user_function_ex(function_table, object_pp, function_name,
> &local_retval_ptr, param_count, params_array, 1, NULL TSRMLS_CC);
> if (local_retval_ptr) {
> @@ -528,7 +533,9 @@
> } else {
> INIT_ZVAL(*retval_ptr);
> }
> - efree(params_array);
> + if (params_array) {
> + efree(params_array);
> + }
> return ex_retval;
> }
>
>
> --
> Zend Engine CVS Mailing List (http://cvs.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>