Improve call_user_function performance

params are all zval * now, and retval will be initialized in
zend_call_function.

maybe we can make call_user_function as a macro proxy to
call_user_function_ex later.
This commit is contained in:
Xinchen Hui 2014-05-26 17:16:22 +08:00
parent b66728aabb
commit bd4b9837e9

View File

@ -626,24 +626,7 @@ ZEND_API int zval_update_constant(zval *pp, zend_bool inline_change TSRMLS_DC) /
int call_user_function(HashTable *function_table, zval *object, zval *function_name, zval *retval_ptr, zend_uint param_count, zval params[] TSRMLS_DC) /* {{{ */
{
zval *params_array;
zend_uint i;
int ex_retval;
if (param_count) {
params_array = (zval *) emalloc(sizeof(zval) * param_count);
for (i=0; i<param_count; i++) {
ZVAL_COPY_VALUE(&params_array[i], &params[i]);
}
} else {
params_array = NULL;
}
ZVAL_UNDEF(retval_ptr);
ex_retval = call_user_function_ex(function_table, object, function_name, retval_ptr, param_count, params_array, 1, NULL TSRMLS_CC);
if (params_array) {
efree(params_array);
}
return ex_retval;
return call_user_function_ex(function_table, object, function_name, retval_ptr, param_count, params, 1, NULL TSRMLS_CC);
}
/* }}} */