diff options
author | Marcus Boerger <helly@php.net> | 2003-06-17 20:18:10 +0000 |
---|---|---|
committer | Marcus Boerger <helly@php.net> | 2003-06-17 20:18:10 +0000 |
commit | 5b3fd9bf2fb49ba9390065dc34ca0359d405c657 (patch) | |
tree | da09dea42c5b39d7a11b0bd16c0d0a24d11b1872 /ext/spl/spl_engine.c | |
parent | 897e6a4069b14d2c8afbf10aa167f2ee58e7e13b (diff) | |
download | php-git-5b3fd9bf2fb49ba9390065dc34ca0359d405c657.tar.gz |
- Remove namespace leftovers
- Convert some static inline functions to macros
- Faster was of function call parameter stack building
Diffstat (limited to 'ext/spl/spl_engine.c')
-rwxr-xr-x | ext/spl/spl_engine.c | 66 |
1 files changed, 35 insertions, 31 deletions
diff --git a/ext/spl/spl_engine.c b/ext/spl/spl_engine.c index 0ddd406223..692be6d094 100755 --- a/ext/spl/spl_engine.c +++ b/ext/spl/spl_engine.c @@ -174,7 +174,10 @@ spl_is_a spl_implements(zend_class_entry *ce) /* {{{ spl_call_method */ int spl_call_method(zval **object_pp, zend_class_entry *obj_ce, zend_function **fn_proxy, char *function_name, int fname_len, zval **retval, HashTable *symbol_table TSRMLS_DC, int param_count, ...) { - int i; + int i, l; + zval *arg; + zval *param; + unsigned char *arg_types; zval **original_return_value; HashTable *calling_symbol_table; zend_function_state *original_function_state_ptr; @@ -213,40 +216,41 @@ int spl_call_method(zval **object_pp, zend_class_entry *obj_ce, zend_function ** } va_start(args, param_count); - for (i=0; i<param_count; i++) { - zval *arg; - zval *param; - - arg = va_arg(args, zval*); - - if (EX(function_state).function->common.arg_types - && i<EX(function_state).function->common.arg_types[0] - && EX(function_state).function->common.arg_types[i+1]==BYREF_FORCE - && !PZVAL_IS_REF(arg)) { - if (arg->refcount > 1) { - zval *new_zval; - - ALLOC_ZVAL(new_zval); - *new_zval = *arg; - zval_copy_ctor(new_zval); - new_zval->refcount = 2; - new_zval->is_ref = 1; - arg->refcount--; - param = new_zval; - } else { + if (param_count) { + if ((arg_types = EX(function_state).function->common.arg_types) != NULL) { + l = arg_types[0]; + } else { + l = 0; + } + for (i=1; i<=param_count; i++) { + arg = va_arg(args, zval*); + + if (i<=l && arg_types[i]==BYREF_FORCE && !PZVAL_IS_REF(arg)) { + if (arg->refcount > 1) { + zval *new_zval; + + ALLOC_ZVAL(new_zval); + *new_zval = *arg; + zval_copy_ctor(new_zval); + new_zval->refcount = 2; + new_zval->is_ref = 1; + arg->refcount--; + param = new_zval; + } else { + arg->refcount++; + arg->is_ref = 1; + param = arg; + } + } else if (arg != &EG(uninitialized_zval)) { arg->refcount++; - arg->is_ref = 1; param = arg; + } else { + ALLOC_ZVAL(param); + *param = *arg; + INIT_PZVAL(param); } - } else if (arg != &EG(uninitialized_zval)) { - arg->refcount++; - param = arg; - } else { - ALLOC_ZVAL(param); - *param = *arg; - INIT_PZVAL(param); + zend_ptr_stack_push(&EG(argument_stack), param); } - zend_ptr_stack_push(&EG(argument_stack), param); } va_end(args); |