Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 07a1a46

Browse files
committed
poll: use php_pollfd instead of struct pollfd
1 parent 4d6e461 commit 07a1a46

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

‎main/poll/poll_backend_poll.c‎

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
typedef struct {
1818
php_poll_fd_table *fd_table;
19-
structpollfd *temp_fds;
19+
php_pollfd *temp_fds;
2020
int temp_fds_capacity;
2121
} poll_backend_data_t;
2222

@@ -76,7 +76,7 @@ static zend_result poll_backend_init(php_poll_ctx *ctx)
7676
return FAILURE;
7777
}
7878

79-
data->temp_fds = php_poll_calloc(initial_capacity, sizeof(structpollfd), ctx->persistent);
79+
data->temp_fds = php_poll_calloc(initial_capacity, sizeof(php_pollfd), ctx->persistent);
8080
if (!data->temp_fds) {
8181
php_poll_fd_table_cleanup(data->fd_table);
8282
pefree(data, ctx->persistent);
@@ -160,13 +160,13 @@ static zend_result poll_backend_remove(php_poll_ctx *ctx, int fd)
160160
return SUCCESS;
161161
}
162162

163-
/* Context for building pollfd array */
163+
/* Context for building php_pollfd array */
164164
typedef struct {
165-
structpollfd *fds;
165+
php_pollfd *fds;
166166
int index;
167167
} poll_build_context;
168168

169-
/* Callback to build pollfd array from fd_table */
169+
/* Callback to build php_pollfd array from fd_table */
170170
static bool poll_build_fds_callback(int fd, php_poll_fd_entry *entry, void *user_data)
171171
{
172172
poll_build_context *ctx = (poll_build_context *) user_data;
@@ -197,8 +197,8 @@ static int poll_backend_wait(php_poll_ctx *ctx, php_poll_event *events, int max_
197197

198198
/* Ensure temp_fds array is large enough */
199199
if (fd_count > backend_data->temp_fds_capacity) {
200-
structpollfd *new_fds = php_poll_realloc(
201-
backend_data->temp_fds, fd_count * sizeof(structpollfd), ctx->persistent);
200+
php_pollfd *new_fds = php_poll_realloc(
201+
backend_data->temp_fds, fd_count * sizeof(php_pollfd), ctx->persistent);
202202
if (!new_fds) {
203203
php_poll_set_error(ctx, PHP_POLL_ERR_NOMEM);
204204
return -1;
@@ -207,7 +207,7 @@ static int poll_backend_wait(php_poll_ctx *ctx, php_poll_event *events, int max_
207207
backend_data->temp_fds_capacity = fd_count;
208208
}
209209

210-
/* Build pollfd array from fd_table */
210+
/* Build php_pollfd array from fd_table */
211211
poll_build_context build_ctx = { .fds = backend_data->temp_fds, .index = 0 };
212212
php_poll_fd_table_foreach(backend_data->fd_table, poll_build_fds_callback, &build_ctx);
213213

@@ -218,10 +218,10 @@ static int poll_backend_wait(php_poll_ctx *ctx, php_poll_event *events, int max_
218218
return nfds; /* Return 0 for timeout, -1 for error */
219219
}
220220

221-
/* Process results - iterate through pollfd array directly */
221+
/* Process results - iterate through php_pollfd array directly */
222222
int event_count = 0;
223223
for (int i = 0; i < fd_count && event_count < max_events; i++) {
224-
structpollfd *pfd = &backend_data->temp_fds[i];
224+
php_pollfd *pfd = &backend_data->temp_fds[i];
225225

226226
if (pfd->revents != 0) {
227227
php_poll_fd_entry *entry = php_poll_fd_table_find(backend_data->fd_table, pfd->fd);

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /