Skip to content

Zend/zend_fibers: change return value to zend_result #10622

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions UPGRADING.INTERNALS
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ PHP 8.3 INTERNALS UPGRADE NOTES
the class table. zend_register_class_alias_ex() will not increase
the refcount for class aliases and the cleanup function takes this
into account.
* The return types of the following functions have been changed from
`bool` to `zend_result`:
- zend_fiber_init_context()

========================
2. Build system changes
Expand Down
8 changes: 4 additions & 4 deletions Zend/zend_fibers.c
Original file line number Diff line number Diff line change
Expand Up @@ -394,12 +394,12 @@ ZEND_API bool zend_fiber_switch_blocked(void)
return zend_fiber_switch_blocking;
}

ZEND_API bool zend_fiber_init_context(zend_fiber_context *context, void *kind, zend_fiber_coroutine coroutine, size_t stack_size)
ZEND_API zend_result zend_fiber_init_context(zend_fiber_context *context, void *kind, zend_fiber_coroutine coroutine, size_t stack_size)
{
context->stack = zend_fiber_stack_allocate(stack_size);

if (UNEXPECTED(!context->stack)) {
return false;
return FAILURE;
}

#ifdef ZEND_FIBER_UCONTEXT
Expand Down Expand Up @@ -438,7 +438,7 @@ ZEND_API bool zend_fiber_init_context(zend_fiber_context *context, void *kind, z

zend_observer_fiber_init_notify(context);

return true;
return SUCCESS;
}

ZEND_API void zend_fiber_destroy_context(zend_fiber_context *context)
Expand Down Expand Up @@ -812,7 +812,7 @@ ZEND_METHOD(Fiber, start)
RETURN_THROWS();
}

if (!zend_fiber_init_context(&fiber->context, zend_ce_fiber, zend_fiber_execute, EG(fiber_stack_size))) {
if (zend_fiber_init_context(&fiber->context, zend_ce_fiber, zend_fiber_execute, EG(fiber_stack_size)) == FAILURE) {
RETURN_THROWS();
}

Expand Down
2 changes: 1 addition & 1 deletion Zend/zend_fibers.h
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ struct _zend_fiber {
};

/* These functions may be used to create custom fiber objects using the bundled fiber switching context. */
ZEND_API bool zend_fiber_init_context(zend_fiber_context *context, void *kind, zend_fiber_coroutine coroutine, size_t stack_size);
ZEND_API zend_result zend_fiber_init_context(zend_fiber_context *context, void *kind, zend_fiber_coroutine coroutine, size_t stack_size);
ZEND_API void zend_fiber_destroy_context(zend_fiber_context *context);
ZEND_API void zend_fiber_switch_context(zend_fiber_transfer *transfer);
#ifdef ZEND_CHECK_STACK_LIMIT
Expand Down