mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
Add zend_call_function_with_return_value()
This API handles the common case of calling a userland function and passing a return value pointer. This allows to remove the 'incorrect' usage of zend_fcall_info_call(fci, fcc, retval, NULL)
This commit is contained in:
parent
9e6588b54e
commit
76fe989cd2
1 changed files with 9 additions and 0 deletions
|
@ -733,6 +733,15 @@ ZEND_API zend_result zend_fcall_info_call(zend_fcall_info *fci, zend_fcall_info_
|
|||
* will be UNDEF. Otherwise, the retval will be a non-UNDEF value. */
|
||||
ZEND_API zend_result zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache);
|
||||
|
||||
/* Call the FCI/FCC pair while setting the call return value to the passed zval*. */
|
||||
static zend_always_inline zend_result zend_call_function_with_return_value(
|
||||
zend_fcall_info *fci, zend_fcall_info_cache *fci_cache, zval *retval)
|
||||
{
|
||||
ZEND_ASSERT(retval && "Use zend_call_function() directly if not providing a retval");
|
||||
fci->retval = retval;
|
||||
return zend_call_function(fci, fci_cache);
|
||||
}
|
||||
|
||||
/* Call the provided zend_function with the given params.
|
||||
* If retval_ptr is NULL, the return value is discarded.
|
||||
* If object is NULL, this must be a free function or static call.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue