summaryrefslogtreecommitdiffhomepage
path: root/src/event
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2007-12-10 12:09:51 +0000
committerIgor Sysoev <igor@sysoev.ru>2007-12-10 12:09:51 +0000
commit86ef6aaa6b574f2015a5094670b7123c425a63af (patch)
treee0b78dcc48085162b29fbff2c0aeb7e5bd75c654 /src/event
parente60049418525a5e605765aa2b8f9c6796eb390a6 (diff)
downloadnginx-86ef6aaa6b574f2015a5094670b7123c425a63af.tar.gz
nginx-86ef6aaa6b574f2015a5094670b7123c425a63af.tar.bz2
move condition declarations inside blocks where they are used
Diffstat (limited to 'src/event')
-rw-r--r--src/event/modules/ngx_select_module.c5
-rw-r--r--src/event/ngx_event.c25
2 files changed, 13 insertions, 17 deletions
diff --git a/src/event/modules/ngx_select_module.c b/src/event/modules/ngx_select_module.c
index 1e704c2f6..19215a79c 100644
--- a/src/event/modules/ngx_select_module.c
+++ b/src/event/modules/ngx_select_module.c
@@ -254,9 +254,6 @@ ngx_select_process_events(ngx_cycle_t *cycle, ngx_msec_t timer,
ngx_event_t *ev, **queue;
ngx_connection_t *c;
struct timeval tv, *tp;
-#if !(NGX_WIN32)
- ngx_uint_t level;
-#endif
#if !(NGX_WIN32)
@@ -348,6 +345,8 @@ ngx_select_process_events(ngx_cycle_t *cycle, ngx_msec_t timer,
#else
if (err) {
+ ngx_uint_t level;
+
if (err == NGX_EINTR) {
if (ngx_event_timer_alarm) {
diff --git a/src/event/ngx_event.c b/src/event/ngx_event.c
index 7a856d409..d34710742 100644
--- a/src/event/ngx_event.c
+++ b/src/event/ngx_event.c
@@ -428,13 +428,9 @@ ngx_event_module_init(ngx_cycle_t *cycle)
void ***cf;
u_char *shared;
size_t size, cl;
- ngx_event_conf_t *ecf;
- ngx_core_conf_t *ccf;
ngx_shm_t shm;
-#if !(NGX_WIN32)
- ngx_int_t limit;
- struct rlimit rlmt;
-#endif
+ ngx_core_conf_t *ccf;
+ ngx_event_conf_t *ecf;
cf = ngx_get_conf(cycle->conf_ctx, ngx_events_module);
@@ -456,6 +452,9 @@ ngx_event_module_init(ngx_cycle_t *cycle)
ngx_timer_resolution = ccf->timer_resolution;
#if !(NGX_WIN32)
+ {
+ ngx_int_t limit;
+ struct rlimit rlmt;
if (getrlimit(RLIMIT_NOFILE, &rlmt) == -1) {
ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
@@ -475,7 +474,7 @@ ngx_event_module_init(ngx_cycle_t *cycle)
ecf->connections, limit);
}
}
-
+ }
#endif /* !(NGX_WIN32) */
@@ -573,13 +572,6 @@ ngx_event_process_init(ngx_cycle_t *cycle)
ngx_core_conf_t *ccf;
ngx_event_conf_t *ecf;
ngx_event_module_t *module;
-#if (NGX_WIN32)
- ngx_iocp_conf_t *iocpcf;
-#else
- struct rlimit rlmt;
- struct sigaction sa;
- struct itimerval itv;
-#endif
ccf = (ngx_core_conf_t *) ngx_get_conf(cycle->conf_ctx, ngx_core_module);
ecf = ngx_event_get_conf(cycle->conf_ctx, ngx_event_core_module);
@@ -625,6 +617,8 @@ ngx_event_process_init(ngx_cycle_t *cycle)
#if !(NGX_WIN32)
if (ngx_timer_resolution && !(ngx_event_flags & NGX_USE_TIMER_EVENT)) {
+ struct sigaction sa;
+ struct itimerval itv;
ngx_memzero(&sa, sizeof(struct sigaction));
sa.sa_handler = ngx_timer_signal_handler;
@@ -648,6 +642,7 @@ ngx_event_process_init(ngx_cycle_t *cycle)
}
if (ngx_event_flags & NGX_USE_FD_EVENT) {
+ struct rlimit rlmt;
if (getrlimit(RLIMIT_NOFILE, &rlmt) == -1) {
ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
@@ -774,6 +769,8 @@ ngx_event_process_init(ngx_cycle_t *cycle)
#if (NGX_WIN32)
if (ngx_event_flags & NGX_USE_IOCP_EVENT) {
+ ngx_iocp_conf_t *iocpcf;
+
rev->handler = ngx_event_acceptex;
if (ngx_add_event(rev, 0, NGX_IOCP_ACCEPT) == NGX_ERROR) {