Skip to content

Commit a3ef478

Browse files
committed
Move decls into ZEND_HASH_FOREACH macros in poll API
1 parent 6041303 commit a3ef478

3 files changed

Lines changed: 6 additions & 16 deletions

File tree

ext/standard/io_poll.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@ static uint32_t php_io_poll_event_enum_to_bit(zend_object *event_enum)
9191
static uint32_t php_io_poll_event_enums_to_events(zval *event_enums)
9292
{
9393
HashTable *ht;
94-
zval *entry;
9594
uint32_t events = 0;
9695

9796
if (Z_TYPE_P(event_enums) != IS_ARRAY) {
@@ -100,7 +99,7 @@ static uint32_t php_io_poll_event_enums_to_events(zval *event_enums)
10099

101100
ht = Z_ARRVAL_P(event_enums);
102101

103-
ZEND_HASH_FOREACH_VAL(ht, entry) {
102+
ZEND_HASH_FOREACH_VAL(ht, zval *entry) {
104103
if (Z_TYPE_P(entry) != IS_OBJECT
105104
|| !instanceof_function(Z_OBJCE_P(entry), php_io_poll_event_class_entry)) {
106105
return 0;
@@ -297,8 +296,7 @@ static void php_io_poll_context_free_object(zend_object *obj)
297296
php_io_poll_context_object *intern = PHP_POLL_CONTEXT_OBJ_FROM_ZOBJ(obj);
298297

299298
if (intern->watchers) {
300-
zval *zv;
301-
ZEND_HASH_FOREACH_VAL(intern->watchers, zv) {
299+
ZEND_HASH_FOREACH_VAL(intern->watchers, zval *zv) {
302300
php_io_poll_watcher_object *watcher = PHP_POLL_WATCHER_OBJ_FROM_ZOBJ(Z_OBJ_P(zv));
303301
watcher->active = false;
304302
watcher->poll_ctx = NULL;
@@ -337,8 +335,7 @@ static HashTable *php_io_poll_context_get_gc(zend_object *obj, zval **table, int
337335
zend_get_gc_buffer *gc_buffer = zend_get_gc_buffer_create();
338336

339337
if (intern->watchers) {
340-
zval *zv;
341-
ZEND_HASH_FOREACH_VAL(intern->watchers, zv) {
338+
ZEND_HASH_FOREACH_VAL(intern->watchers, zval *zv) {
342339
zend_get_gc_buffer_add_zval(gc_buffer, zv);
343340
} ZEND_HASH_FOREACH_END();
344341
}

main/poll/poll_backend_kqueue.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -420,10 +420,8 @@ static int kqueue_backend_wait(
420420

421421
if (garbage_events > 0) {
422422
/* Clean up orphaned filters from complete oneshot FDs */
423-
zend_ulong fd_key;
424-
zval *tracking;
425423
struct kevent cleanup_change;
426-
ZEND_HASH_FOREACH_NUM_KEY_VAL(backend_data->fd_tracking, fd_key, tracking)
424+
ZEND_HASH_FOREACH_NUM_KEY_VAL(backend_data->fd_tracking, zend_ulong fd_key, zval *tracking)
427425
{
428426
zend_long flags = Z_LVAL_P(tracking);
429427
if (flags & KQUEUE_FD_HAS_GARBAGE) {

main/poll/poll_fd_table.c

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,7 @@ php_poll_fd_table *php_poll_fd_table_init(int initial_capacity, bool persistent)
3434
void php_poll_fd_table_cleanup(php_poll_fd_table *table)
3535
{
3636
if (table) {
37-
zval *zv;
38-
39-
ZEND_HASH_FOREACH_VAL(&table->entries_ht, zv)
37+
ZEND_HASH_FOREACH_VAL(&table->entries_ht, zval *zv)
4038
{
4139
php_poll_fd_entry *entry = Z_PTR_P(zv);
4240
pefree(entry, table->persistent);
@@ -105,10 +103,7 @@ typedef bool (*php_poll_fd_iterator_func_t)(int fd, php_poll_fd_entry *entry, vo
105103
void php_poll_fd_table_foreach(
106104
php_poll_fd_table *table, php_poll_fd_iterator_func_t callback, void *user_data)
107105
{
108-
zend_ulong fd;
109-
zval *zv;
110-
111-
ZEND_HASH_FOREACH_NUM_KEY_VAL(&table->entries_ht, fd, zv)
106+
ZEND_HASH_FOREACH_NUM_KEY_VAL(&table->entries_ht, zend_ulong fd, zval *zv)
112107
{
113108
php_poll_fd_entry *entry = Z_PTR_P(zv);
114109
if (entry->active && !callback((int) fd, entry, user_data)) {

0 commit comments

Comments
 (0)