Use inlined version of zval_ptr_dtor() in array_map() loop

This commit is contained in:
Dmitry Stogov 2017-06-29 12:15:57 +03:00
parent e111bccd48
commit 5a51da9942

View file

@ -6024,6 +6024,7 @@ PHP_FUNCTION(array_map)
zend_ulong num_key;
zend_string *str_key;
zval *zv, arg;
int ret;
if (Z_TYPE(arrays[0]) != IS_ARRAY) {
php_error_docref(NULL, E_WARNING, "Argument #%d should be an array", 2);
@ -6046,13 +6047,11 @@ PHP_FUNCTION(array_map)
fci.no_separation = 0;
ZVAL_COPY(&arg, zv);
if (zend_call_function(&fci, &fci_cache) != SUCCESS || Z_TYPE(result) == IS_UNDEF) {
zval_dtor(return_value);
zval_ptr_dtor(&arg);
ret = zend_call_function(&fci, &fci_cache);
i_zval_ptr_dtor(&arg ZEND_FILE_LINE_CC);
if (ret != SUCCESS || Z_TYPE(result) == IS_UNDEF) {
zend_array_destroy(Z_ARR_P(return_value));
RETURN_NULL();
} else {
zval_ptr_dtor(&arg);
}
if (str_key) {
zend_hash_add_new(Z_ARRVAL_P(return_value), str_key, &result);
@ -6136,7 +6135,7 @@ PHP_FUNCTION(array_map)
if (zend_call_function(&fci, &fci_cache) != SUCCESS || Z_TYPE(result) == IS_UNDEF) {
efree(array_pos);
zval_dtor(return_value);
zend_array_destroy(Z_ARR_P(return_value));
for (i = 0; i < n_arrays; i++) {
zval_ptr_dtor(&params[i]);
}