Remove unnecessary result variable

Instead directly use return_value. Hopefully this also works
around the "may be uninitialized" warning...
This commit is contained in:
Nikita Popov 2020-01-20 11:05:34 +01:00
parent 6811222422
commit 0fbdc5a378

View File

@ -6011,7 +6011,6 @@ PHP_FUNCTION(array_reduce)
zval *input;
zval args[2];
zval *operand;
zval result;
zval retval;
zend_fcall_info fci;
zend_fcall_info_cache fci_cache = empty_fcall_info_cache;
@ -6027,9 +6026,9 @@ PHP_FUNCTION(array_reduce)
if (ZEND_NUM_ARGS() > 2) {
ZVAL_COPY(&result, initial);
ZVAL_COPY(return_value, initial);
} else {
ZVAL_NULL(&result);
ZVAL_NULL(return_value);
}
/* (zval **)input points to an element of argument stack
@ -6038,7 +6037,6 @@ PHP_FUNCTION(array_reduce)
htbl = Z_ARRVAL_P(input);
if (zend_hash_num_elements(htbl) == 0) {
ZVAL_COPY_VALUE(return_value, &result);
zend_release_fcall_info_cache(&fci_cache);
return;
}
@ -6048,14 +6046,14 @@ PHP_FUNCTION(array_reduce)
fci.no_separation = 0;
ZEND_HASH_FOREACH_VAL(htbl, operand) {
ZVAL_COPY_VALUE(&args[0], &result);
ZVAL_COPY_VALUE(&args[0], return_value);
ZVAL_COPY(&args[1], operand);
fci.params = args;
if (zend_call_function(&fci, &fci_cache) == SUCCESS && Z_TYPE(retval) != IS_UNDEF) {
zval_ptr_dtor(&args[1]);
zval_ptr_dtor(&args[0]);
ZVAL_COPY_VALUE(&result, &retval);
ZVAL_COPY_VALUE(return_value, &retval);
} else {
zval_ptr_dtor(&args[1]);
zval_ptr_dtor(&args[0]);
@ -6064,7 +6062,6 @@ PHP_FUNCTION(array_reduce)
} ZEND_HASH_FOREACH_END();
zend_release_fcall_info_cache(&fci_cache);
RETURN_COPY_VALUE(&result);
}
/* }}} */