Skip to content

Commit ec0e8b5

Browse files
author
jiahao
committed
optimize: put ev variable as local variable.
1 parent 80b0d71 commit ec0e8b5

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/event/ngx_http_lua_epoll.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ static ngx_int_t ngx_http_lua_epoll_process_event(ngx_http_request_t *r,
1818
ngx_msec_t timer);
1919

2020
static int ep = -1;
21-
static struct epoll_event eev;
2221

2322
ngx_http_lua_event_actions_t ngx_http_lua_epoll = {
2423
ngx_http_lua_epoll_init_event,
@@ -149,8 +148,9 @@ ngx_http_lua_epoll_process_event(ngx_http_request_t *r, ngx_msec_t timer)
149148
ngx_err_t err;
150149
ngx_event_t *rev, *wev;
151150
ngx_connection_t *c;
151+
struct epoll_event ee;
152152

153-
events = epoll_wait(ep, &eev, 1, timer);
153+
events = epoll_wait(ep, &ee, 1, timer);
154154

155155
err = (events == -1) ? ngx_errno : 0;
156156

@@ -168,8 +168,8 @@ ngx_http_lua_epoll_process_event(ngx_http_request_t *r, ngx_msec_t timer)
168168
return NGX_ERROR;
169169
}
170170

171-
c = eev.data.ptr;
172-
revents = eev.events;
171+
c = ee.data.ptr;
172+
revents = ee.events;
173173

174174
if (revents & (EPOLLERR|EPOLLHUP)) {
175175
ngx_log_debug2(NGX_LOG_DEBUG_EVENT, r->connection->log, 0,

src/event/ngx_http_lua_kqueue.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ static ngx_int_t ngx_http_lua_kqueue_process_event(ngx_http_request_t *r,
2020

2121
int kq = -1;
2222
static struct kevent kch[2];
23-
static struct kevent kev;
2423
static ngx_uint_t nchanges;
2524

2625
ngx_http_lua_event_actions_t ngx_http_lua_kqueue = {
@@ -100,6 +99,7 @@ ngx_http_lua_kqueue_process_event(ngx_http_request_t *r, ngx_msec_t timer)
10099
struct timespec ts;
101100
ngx_event_t *ev;
102101
ngx_err_t err;
102+
struct kevent kev;
103103

104104
ts.tv_sec = timer / 1000;
105105
ts.tv_nsec = (timer % 1000) * 1000000;

0 commit comments

Comments
 (0)