Skip to content

Commit be1f74c

Browse files
committed
Apply clang-format to modified C files
1 parent a8220d0 commit be1f74c

File tree

3 files changed

+29
-25
lines changed

3 files changed

+29
-25
lines changed

async.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -909,8 +909,7 @@ static PHP_GINIT_FUNCTION(async)
909909
}
910910

911911
/* {{{ PHP_GSHUTDOWN_FUNCTION */
912-
static PHP_GSHUTDOWN_FUNCTION(async)
913-
{
912+
static PHP_GSHUTDOWN_FUNCTION(async){
914913
#ifdef PHP_WIN32
915914
#endif
916915
} /* }}} */

libuv_reactor.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -860,7 +860,7 @@ zend_async_signal_event_t *libuv_new_signal_event(int signum, size_t extra_size)
860860
*
861861
* Thus, ASYNC_G(process_events) is a hash table with the key as ProcessId
862862
* and the value as an Event for process handling.
863-
**/
863+
**/
864864

865865
/* {{{ libuv_signal_close_cb */
866866
static void libuv_signal_close_cb(uv_handle_t *handle)
@@ -1030,11 +1030,10 @@ static void libuv_handle_process_events(void)
10301030

10311031
// Get PID to use as key for verification
10321032
async_process_event_t *process = (async_process_event_t *) event;
1033-
uintptr_t pid_key = (uintptr_t)process->event.process;
1033+
uintptr_t pid_key = (uintptr_t) process->event.process;
10341034

10351035
// Verify event is still in the HashTable (might have been removed)
1036-
if (ASYNC_G(process_events) == NULL ||
1037-
zend_hash_index_find_ptr(ASYNC_G(process_events), pid_key) == NULL) {
1036+
if (ASYNC_G(process_events) == NULL || zend_hash_index_find_ptr(ASYNC_G(process_events), pid_key) == NULL) {
10381037
continue;
10391038
}
10401039

@@ -1103,9 +1102,9 @@ static void libuv_remove_process_event(zend_async_event_t *event)
11031102
}
11041103

11051104
// Get process handle from event to use as key
1106-
async_process_event_t *process_event = (async_process_event_t *)event;
1105+
async_process_event_t *process_event = (async_process_event_t *) event;
11071106

1108-
zend_hash_index_del(ASYNC_G(process_events), (uintptr_t)process_event->event.process);
1107+
zend_hash_index_del(ASYNC_G(process_events), (uintptr_t) process_event->event.process);
11091108

11101109
// Only remove SIGCHLD handler if no more process events AND no regular signal events for SIGCHLD
11111110
if (zend_hash_num_elements(ASYNC_G(process_events)) == 0) {
@@ -1574,7 +1573,7 @@ zend_async_process_event_t *libuv_new_process_event(zend_process_t process_handl
15741573
START_REACTOR_OR_RETURN_NULL;
15751574

15761575
// Use process handle as key for hash lookup
1577-
uintptr_t pid_key = (uintptr_t)process_handle;
1576+
uintptr_t pid_key = (uintptr_t) process_handle;
15781577

15791578
// Initialize process_events if needed
15801579
if (ASYNC_G(process_events) == NULL) {

scheduler.c

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -533,12 +533,12 @@ static bool resolve_deadlocks(void)
533533
//
534534
zend_long fiber_coroutines_count = 0;
535535

536-
ZEND_HASH_FOREACH_VAL(&ASYNC_G(coroutines), value) {
536+
ZEND_HASH_FOREACH_VAL(&ASYNC_G(coroutines), value)
537+
{
537538
const zend_coroutine_t *coroutine = (zend_coroutine_t *) Z_PTR_P(value);
538539

539-
if (ZEND_COROUTINE_IS_FIBER(coroutine)
540-
&& ZEND_COROUTINE_IS_YIELD(coroutine)
541-
&& coroutine->extended_data != NULL) {
540+
if (ZEND_COROUTINE_IS_FIBER(coroutine) && ZEND_COROUTINE_IS_YIELD(coroutine) &&
541+
coroutine->extended_data != NULL) {
542542
fiber_coroutines_count++;
543543
}
544544
}
@@ -550,13 +550,13 @@ static bool resolve_deadlocks(void)
550550
//
551551
if (fiber_coroutines_count == real_coroutines) {
552552

553-
ZEND_HASH_FOREACH_VAL(&ASYNC_G(coroutines), value) {
553+
ZEND_HASH_FOREACH_VAL(&ASYNC_G(coroutines), value)
554+
{
554555
zend_coroutine_t *coroutine = (zend_coroutine_t *) Z_PTR_P(value);
555556

556-
if (ZEND_COROUTINE_IS_FIBER(coroutine)
557-
&& ZEND_COROUTINE_IS_YIELD(coroutine)
558-
&& coroutine->extended_data != NULL) {
559-
ZEND_ASYNC_CANCEL(coroutine, zend_create_graceful_exit(), true);
557+
if (ZEND_COROUTINE_IS_FIBER(coroutine) && ZEND_COROUTINE_IS_YIELD(coroutine) &&
558+
coroutine->extended_data != NULL) {
559+
ZEND_ASYNC_CANCEL(coroutine, zend_create_graceful_exit(), true);
560560

561561
if (UNEXPECTED(EG(exception) != NULL)) {
562562
return true;
@@ -568,8 +568,10 @@ static bool resolve_deadlocks(void)
568568
}
569569

570570
// Create deadlock exception to be set as exit_exception
571-
zend_object *deadlock_exception = async_new_exception(async_ce_deadlock_error,
572-
"Deadlock detected: no active coroutines, %u coroutines in waiting", real_coroutines);
571+
zend_object *deadlock_exception =
572+
async_new_exception(async_ce_deadlock_error,
573+
"Deadlock detected: no active coroutines, %u coroutines in waiting",
574+
real_coroutines);
573575

574576
// Set as exit exception if there isn't one already
575577
if (ZEND_ASYNC_EXIT_EXCEPTION == NULL) {
@@ -580,7 +582,8 @@ static bool resolve_deadlocks(void)
580582
ZEND_ASYNC_EXIT_EXCEPTION = deadlock_exception;
581583
}
582584

583-
ZEND_HASH_FOREACH_VAL(&ASYNC_G(coroutines), value) {
585+
ZEND_HASH_FOREACH_VAL(&ASYNC_G(coroutines), value)
586+
{
584587
async_coroutine_t *coroutine = (async_coroutine_t *) Z_PTR_P(value);
585588

586589
ZEND_ASSERT(coroutine->coroutine.waker != NULL && "The Coroutine has no waker object");
@@ -1061,8 +1064,8 @@ bool async_scheduler_coroutine_enqueue(zend_coroutine_t *coroutine)
10611064

10621065
// Behavior for a new coroutine
10631066
// see: async_API.c spawn(zend_async_scope_t *scope, zend_object *scope_provider, int32_t priority)
1064-
if (false == ZEND_COROUTINE_IS_STARTED(coroutine)
1065-
&& zend_hash_index_find(&ASYNC_G(coroutines), ((async_coroutine_t *)coroutine)->std.handle) == NULL) {
1067+
if (false == ZEND_COROUTINE_IS_STARTED(coroutine) &&
1068+
zend_hash_index_find(&ASYNC_G(coroutines), ((async_coroutine_t *) coroutine)->std.handle) == NULL) {
10661069
// save the filename and line number where the coroutine was created
10671070
zend_apply_current_filename_and_line(&coroutine->filename, &coroutine->lineno);
10681071

@@ -1076,7 +1079,9 @@ bool async_scheduler_coroutine_enqueue(zend_coroutine_t *coroutine)
10761079
return false;
10771080
}
10781081

1079-
if (UNEXPECTED(zend_hash_index_add_ptr(&ASYNC_G(coroutines), ((async_coroutine_t *)coroutine)->std.handle, coroutine) == NULL)) {
1082+
if (UNEXPECTED(zend_hash_index_add_ptr(&ASYNC_G(coroutines),
1083+
((async_coroutine_t *) coroutine)->std.handle,
1084+
coroutine) == NULL)) {
10801085
coroutine->waker->status = ZEND_ASYNC_WAKER_IGNORED;
10811086
async_throw_error("Failed to add coroutine to the list");
10821087
return false;
@@ -1144,7 +1149,8 @@ static zend_always_inline void scheduler_next_tick(void)
11441149
// Fast return path without context switching...
11451150
zend_coroutine_t *coroutine = ZEND_ASYNC_CURRENT_COROUTINE;
11461151

1147-
if (UNEXPECTED(coroutine != NULL && coroutine->waker != NULL && coroutine->waker->status == ZEND_ASYNC_WAKER_RESULT)) {
1152+
if (UNEXPECTED(coroutine != NULL && coroutine->waker != NULL &&
1153+
coroutine->waker->status == ZEND_ASYNC_WAKER_RESULT)) {
11481154
return;
11491155
}
11501156

0 commit comments

Comments
 (0)