mirror of
https://github.com/php/php-src.git
synced 2024-11-25 02:44:58 +08:00
Make use of direct returns in some places
This commit is contained in:
parent
0856714576
commit
47ee470992
@ -59,14 +59,8 @@ ZEND_METHOD(Closure, __invoke) /* {{{ */
|
||||
} else if (call_user_function_ex(CG(function_table), NULL, this_ptr, &closure_result_ptr, ZEND_NUM_ARGS(), arguments, 1, NULL TSRMLS_CC) == FAILURE) {
|
||||
RETVAL_FALSE;
|
||||
} else if (closure_result_ptr) {
|
||||
if (Z_ISREF_P(closure_result_ptr) && return_value_ptr) {
|
||||
if (return_value) {
|
||||
zval_ptr_dtor(&return_value);
|
||||
}
|
||||
*return_value_ptr = closure_result_ptr;
|
||||
} else {
|
||||
RETVAL_ZVAL(closure_result_ptr, 1, 1);
|
||||
}
|
||||
zval_ptr_dtor(&return_value);
|
||||
*return_value_ptr = closure_result_ptr;
|
||||
}
|
||||
efree(arguments);
|
||||
|
||||
|
@ -430,7 +430,7 @@ ZEND_METHOD(Generator, current)
|
||||
zend_generator_ensure_initialized(generator TSRMLS_CC);
|
||||
|
||||
if (generator->value) {
|
||||
RETURN_ZVAL(generator->value, 1, 0);
|
||||
RETURN_ZVAL_FAST(generator->value);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
@ -450,7 +450,7 @@ ZEND_METHOD(Generator, key)
|
||||
zend_generator_ensure_initialized(generator TSRMLS_CC);
|
||||
|
||||
if (generator->key) {
|
||||
RETURN_ZVAL(generator->key, 1, 0);
|
||||
RETURN_ZVAL_FAST(generator->key);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
@ -499,7 +499,7 @@ ZEND_METHOD(Generator, send)
|
||||
zend_generator_resume(generator TSRMLS_CC);
|
||||
|
||||
if (generator->value) {
|
||||
RETURN_ZVAL(generator->value, 1, 0);
|
||||
RETURN_ZVAL_FAST(generator->value);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
@ -532,7 +532,7 @@ ZEND_METHOD(Generator, throw)
|
||||
zend_generator_resume(generator TSRMLS_CC);
|
||||
|
||||
if (generator->value) {
|
||||
RETURN_ZVAL(generator->value, 1, 0);
|
||||
RETURN_ZVAL_FAST(generator->value);
|
||||
}
|
||||
} else {
|
||||
/* If the generator is already closed throw the exception in the
|
||||
|
@ -896,11 +896,8 @@ ZEND_API void zend_std_call_user_call(INTERNAL_FUNCTION_PARAMETERS) /* {{{ */
|
||||
zend_call_method_with_2_params(&this_ptr, ce, &ce->__call, ZEND_CALL_FUNC_NAME, &method_result_ptr, method_name_ptr, method_args_ptr);
|
||||
|
||||
if (method_result_ptr) {
|
||||
if (Z_ISREF_P(method_result_ptr) || Z_REFCOUNT_P(method_result_ptr) > 1) {
|
||||
RETVAL_ZVAL(method_result_ptr, 1, 1);
|
||||
} else {
|
||||
RETVAL_ZVAL(method_result_ptr, 0, 1);
|
||||
}
|
||||
RETVAL_ZVAL_FAST(method_result_ptr);
|
||||
zval_ptr_dtor(&method_result_ptr);
|
||||
}
|
||||
|
||||
/* now destruct all auxiliaries */
|
||||
@ -1113,11 +1110,8 @@ ZEND_API void zend_std_callstatic_user_call(INTERNAL_FUNCTION_PARAMETERS) /* {{{
|
||||
zend_call_method_with_2_params(NULL, ce, &ce->__callstatic, ZEND_CALLSTATIC_FUNC_NAME, &method_result_ptr, method_name_ptr, method_args_ptr);
|
||||
|
||||
if (method_result_ptr) {
|
||||
if (Z_ISREF_P(method_result_ptr) || Z_REFCOUNT_P(method_result_ptr) > 1) {
|
||||
RETVAL_ZVAL(method_result_ptr, 1, 1);
|
||||
} else {
|
||||
RETVAL_ZVAL(method_result_ptr, 0, 1);
|
||||
}
|
||||
RETVAL_ZVAL_FAST(method_result_ptr);
|
||||
zval_ptr_dtor(&method_result_ptr);
|
||||
}
|
||||
|
||||
/* now destruct all auxiliaries */
|
||||
|
@ -830,7 +830,7 @@ PHP_FUNCTION(end)
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
RETURN_ZVAL(*entry, 1, 0);
|
||||
RETURN_ZVAL_FAST(*entry);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
@ -853,7 +853,7 @@ PHP_FUNCTION(prev)
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
RETURN_ZVAL(*entry, 1, 0);
|
||||
RETURN_ZVAL_FAST(*entry);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
@ -876,7 +876,7 @@ PHP_FUNCTION(next)
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
RETURN_ZVAL(*entry, 1, 0);
|
||||
RETURN_ZVAL_FAST(*entry);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
@ -899,7 +899,7 @@ PHP_FUNCTION(reset)
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
RETURN_ZVAL(*entry, 1, 0);
|
||||
RETURN_ZVAL_FAST(*entry);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
@ -918,7 +918,8 @@ PHP_FUNCTION(current)
|
||||
if (zend_hash_get_current_data(array, (void **) &entry) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
RETURN_ZVAL(*entry, 1, 0);
|
||||
|
||||
RETURN_ZVAL_FAST(*entry);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@ -958,7 +959,7 @@ PHP_FUNCTION(min)
|
||||
RETVAL_NULL();
|
||||
} else {
|
||||
if (zend_hash_minmax(Z_ARRVAL_PP(args[0]), php_array_data_compare, 0, (void **) &result TSRMLS_CC) == SUCCESS) {
|
||||
RETVAL_ZVAL(*result, 1, 0);
|
||||
RETVAL_ZVAL_FAST(*result);
|
||||
} else {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Array must contain at least one element");
|
||||
RETVAL_FALSE;
|
||||
@ -978,7 +979,7 @@ PHP_FUNCTION(min)
|
||||
}
|
||||
}
|
||||
|
||||
RETVAL_ZVAL(*min, 1, 0);
|
||||
RETVAL_ZVAL_FAST(*min);
|
||||
}
|
||||
|
||||
if (args) {
|
||||
@ -1009,7 +1010,7 @@ PHP_FUNCTION(max)
|
||||
RETVAL_NULL();
|
||||
} else {
|
||||
if (zend_hash_minmax(Z_ARRVAL_PP(args[0]), php_array_data_compare, 1, (void **) &result TSRMLS_CC) == SUCCESS) {
|
||||
RETVAL_ZVAL(*result, 1, 0);
|
||||
RETVAL_ZVAL_FAST(*result);
|
||||
} else {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Array must contain at least one element");
|
||||
RETVAL_FALSE;
|
||||
@ -1029,7 +1030,7 @@ PHP_FUNCTION(max)
|
||||
}
|
||||
}
|
||||
|
||||
RETVAL_ZVAL(*max, 1, 0);
|
||||
RETVAL_ZVAL_FAST(*max);
|
||||
}
|
||||
|
||||
if (args) {
|
||||
@ -1955,7 +1956,7 @@ static void _phpi_pop(INTERNAL_FUNCTION_PARAMETERS, int off_the_end)
|
||||
zend_hash_internal_pointer_reset(Z_ARRVAL_P(stack));
|
||||
}
|
||||
zend_hash_get_current_data(Z_ARRVAL_P(stack), (void **)&val);
|
||||
RETVAL_ZVAL(*val, 1, 0);
|
||||
RETVAL_ZVAL_FAST(*val);
|
||||
|
||||
/* Delete the first or last value */
|
||||
zend_hash_get_current_key_ex(Z_ARRVAL_P(stack), &key, &key_len, &index, 0, NULL);
|
||||
|
Loading…
Reference in New Issue
Block a user