Welcome! Log In Create A New Profile

Advanced

[PATCH] change nevents type in ngx_poll_module.c to ngx_uint_t

August 07, 2014 09:16AM
Hello,

In ngx_epoll_module.c, nevents is defined as ngx_uint_t and ev->index is also a ngx_uint_t.
So I proposed to change nevents type.

I'm not sure about variable declaration:
- ngx_int_t i, nready;
+ ngx_uint_t i;
+ ngx_int_t nready;
ngx_uint_t found, level;

It's perhaps better to group variable by type:
- ngx_int_t i, nready;
+ ngx_int_t nready;
+ ngx_uint_t i, found, level;

regards,

yves

# HG changeset patch
# User Yves Crespin<yves.crespin@e-quartz.fr>
# Date 1407416217 -7200
# Node ID b71a279c696bcd18bd6b3c2845fe8e51d57ea1fd
# Parent c51d0d718b2177daaf14895840beb528e332418b
change nevents type in ngx_poll_module.c to ngx_uint_t

diff -r c51d0d718b21 -r b71a279c696b src/event/modules/ngx_poll_module.c
--- a/src/event/modules/ngx_poll_module.c Thu Aug 07 14:32:24 2014 +0200
+++ b/src/event/modules/ngx_poll_module.c Thu Aug 07 14:56:57 2014 +0200
@@ -22,7 +22,7 @@


static struct pollfd *event_list;
-static ngx_int_t nevents;
+static ngx_uint_t nevents;


static ngx_str_t poll_name = ngx_string("poll");
@@ -198,7 +198,7 @@
if (e == NULL || e->index == NGX_INVALID_INDEX) {
nevents--;

- if (ev->index < (ngx_uint_t) nevents) {
+ if (ev->index < nevents) {

ngx_log_debug2(NGX_LOG_DEBUG_EVENT, ev->log, 0,
"index: copy event %ui to %i", nevents, ev->index);
@@ -212,11 +212,11 @@
"unexpected last event");

} else {
- if (c->read->index == (ngx_uint_t) nevents) {
+ if (c->read->index == nevents) {
c->read->index = ev->index;
}

- if (c->write->index == (ngx_uint_t) nevents) {
+ if (c->write->index == nevents) {
c->write->index = ev->index;
}
}
@@ -240,7 +240,8 @@
{
int ready, revents;
ngx_err_t err;
- ngx_int_t i, nready;
+ ngx_uint_t i;
+ ngx_int_t nready;
ngx_uint_t found, level;
ngx_event_t *ev, **queue;
ngx_connection_t *c;
Subject Author Posted

[PATCH] change nevents type in ngx_poll_module.c to ngx_uint_t

crespin August 07, 2014 09:16AM

Re: [PATCH] change nevents type in ngx_poll_module.c to ngx_uint_t

Maxim Dounin August 10, 2014 09:18AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 239
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready