mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
Merge branch 'PHP-5.5'
* PHP-5.5: Improved performance of func_get_args() by eliminating useless copying Conflicts: NEWS
This commit is contained in:
commit
9bbdc90ed2
1 changed files with 10 additions and 5 deletions
|
@ -461,12 +461,17 @@ ZEND_FUNCTION(func_get_args)
|
||||||
|
|
||||||
array_init_size(return_value, arg_count);
|
array_init_size(return_value, arg_count);
|
||||||
for (i=0; i<arg_count; i++) {
|
for (i=0; i<arg_count; i++) {
|
||||||
zval *element;
|
zval *element, *arg;
|
||||||
|
|
||||||
ALLOC_ZVAL(element);
|
arg = *((zval **) (p-(arg_count-i)));
|
||||||
*element = **((zval **) (p-(arg_count-i)));
|
if (!Z_ISREF_P(arg)) {
|
||||||
zval_copy_ctor(element);
|
element = arg;
|
||||||
INIT_PZVAL(element);
|
Z_ADDREF_P(element);
|
||||||
|
} else {
|
||||||
|
ALLOC_ZVAL(element);
|
||||||
|
INIT_PZVAL_COPY(element, arg);
|
||||||
|
zval_copy_ctor(element);
|
||||||
|
}
|
||||||
zend_hash_next_index_insert(return_value->value.ht, &element, sizeof(zval *), NULL);
|
zend_hash_next_index_insert(return_value->value.ht, &element, sizeof(zval *), NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue