move condition declarations inside blocks where they are used
diff --git a/src/core/nginx.c b/src/core/nginx.c
index ae68605..ee63682 100644
--- a/src/core/nginx.c
+++ b/src/core/nginx.c
@@ -758,12 +758,6 @@
{
ngx_core_conf_t *ccf = conf;
-#if !(NGX_WIN32)
- ngx_str_t lock_file;
- struct group *grp;
- struct passwd *pwd;
-#endif
-
ngx_conf_init_value(ccf->daemon, 1);
ngx_conf_init_value(ccf->master, 1);
ngx_conf_init_msec_value(ccf->timer_resolution, 0);
@@ -796,6 +790,8 @@
#if !(NGX_WIN32)
if (ccf->user == (uid_t) NGX_CONF_UNSET_UINT && geteuid() == 0) {
+ struct group *grp;
+ struct passwd *pwd;
ngx_set_errno(0);
pwd = getpwnam(NGX_USER);
@@ -848,6 +844,9 @@
return NGX_CONF_ERROR;
}
+ {
+ ngx_str_t lock_file;
+
lock_file = cycle->old_cycle->lock_file;
if (lock_file.len) {
@@ -881,6 +880,7 @@
ccf->lock_file.len),
".accept", sizeof(".accept"));
}
+ }
#endif
diff --git a/src/core/ngx_cycle.c b/src/core/ngx_cycle.c
index f900a28..f0e86eb 100644
--- a/src/core/ngx_cycle.c
+++ b/src/core/ngx_cycle.c
@@ -938,9 +938,6 @@
ngx_uint_t i;
ngx_list_part_t *part;
ngx_open_file_t *file;
-#if !(NGX_WIN32)
- ngx_file_info_t fi;
-#endif
part = &cycle->open_files.part;
file = part->elts;
@@ -996,6 +993,7 @@
}
#else
if (user != (ngx_uid_t) NGX_CONF_UNSET_UINT) {
+ ngx_file_info_t fi;
if (ngx_file_info((const char *) file[i].name.data, &fi) == -1) {
ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno,
diff --git a/src/core/ngx_file.c b/src/core/ngx_file.c
index c945b55..8edd3e1 100644
--- a/src/core/ngx_file.c
+++ b/src/core/ngx_file.c
@@ -425,9 +425,6 @@
ngx_err_t err;
ngx_uint_t i;
ngx_path_t **path;
-#if !(NGX_WIN32)
- ngx_file_info_t fi;
-#endif
path = cycle->pathes.elts;
for (i = 0; i < cycle->pathes.nelts; i++) {
@@ -447,6 +444,8 @@
}
#if !(NGX_WIN32)
+ {
+ ngx_file_info_t fi;
if (ngx_file_info((const char *) path[i]->name.data, &fi) == -1) {
ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno,
@@ -474,7 +473,7 @@
return NGX_ERROR;
}
}
-
+ }
#endif
}