diff src/core/ngx_cycle.c @ 50:72eb30262aac NGINX_0_1_25

nginx 0.1.25 *) Bugfix: nginx did run on Linux parisc. *) Feature: nginx now does not start under FreeBSD if the sysctl kern.ipc.somaxconn value is too big. *) Bugfix: if a request was internally redirected by the ngx_http_index_module module to the ngx_http_proxy_module or ngx_http_fastcgi_module modules, then the index file was not closed after request completion. *) Feature: the "proxy_pass" can be used in location with regular expression. *) Feature: the ngx_http_rewrite_filter_module module supports the condition like "if ($HTTP_USER_AGENT ~ MSIE)". *) Bugfix: nginx started too slow if the large number of addresses and text values were used in the "geo" directive. *) Change: a variable name must be declared as "$name" in the "geo" directive. The previous variant without "$" is still supported, but will be removed soon. *) Feature: the "%{VARIABLE}v" logging parameter. *) Feature: the "set $name value" directive. *) Bugfix: gcc 4.0 compatibility. *) Feature: the --with-openssl-opt=OPTIONS autoconfiguration directive.
author Igor Sysoev <http://sysoev.ru>
date Sat, 19 Mar 2005 00:00:00 +0300
parents 7ca9bdc82b3f
children 3050baa54a26
line wrap: on
line diff
--- a/src/core/ngx_cycle.c
+++ b/src/core/ngx_cycle.c
@@ -54,15 +54,18 @@ ngx_cycle_t *ngx_init_cycle(ngx_cycle_t 
 
     log = old_cycle->log;
 
-    if (!(pool = ngx_create_pool(16 * 1024, log))) {
+    pool = ngx_create_pool(16 * 1024, log);
+    if (pool == NULL) {
         return NULL;
     }
     pool->log = log;
 
-    if (!(cycle = ngx_pcalloc(pool, sizeof(ngx_cycle_t)))) {
+    cycle = ngx_pcalloc(pool, sizeof(ngx_cycle_t));
+    if (cycle == NULL) {
         ngx_destroy_pool(pool);
         return NULL;
     }
+
     cycle->pool = pool;
     cycle->log = log;
     cycle->old_cycle = old_cycle;
@@ -72,10 +75,13 @@ ngx_cycle_t *ngx_init_cycle(ngx_cycle_t 
 
 
     n = old_cycle->pathes.nelts ? old_cycle->pathes.nelts : 10;
-    if (!(cycle->pathes.elts = ngx_pcalloc(pool, n * sizeof(ngx_path_t *)))) {
+
+    cycle->pathes.elts = ngx_pcalloc(pool, n * sizeof(ngx_path_t *));
+    if (cycle->pathes.elts == NULL) {
         ngx_destroy_pool(pool);
         return NULL;
     }
+
     cycle->pathes.nelts = 0;
     cycle->pathes.size = sizeof(ngx_path_t *);
     cycle->pathes.nalloc = n;
@@ -100,7 +106,8 @@ ngx_cycle_t *ngx_init_cycle(ngx_cycle_t 
     }
 
 
-    if (!(cycle->new_log = ngx_log_create_errlog(cycle, NULL))) {
+    cycle->new_log = ngx_log_create_errlog(cycle, NULL);
+    if (cycle->new_log == NULL) {
         ngx_destroy_pool(pool);
         return NULL;
     }
@@ -109,11 +116,13 @@ ngx_cycle_t *ngx_init_cycle(ngx_cycle_t 
 
 
     n = old_cycle->listening.nelts ? old_cycle->listening.nelts : 10;
+
     cycle->listening.elts = ngx_pcalloc(pool, n * sizeof(ngx_listening_t));
     if (cycle->listening.elts == NULL) {
         ngx_destroy_pool(pool);
         return NULL;
     }
+
     cycle->listening.nelts = 0;
     cycle->listening.size = sizeof(ngx_listening_t);
     cycle->listening.nalloc = n;
@@ -147,7 +156,7 @@ ngx_cycle_t *ngx_init_cycle(ngx_cycle_t 
 
     ngx_memzero(&conf, sizeof(ngx_conf_t));
     /* STUB: init array ? */
-    conf.args = ngx_create_array(pool, 10, sizeof(ngx_str_t));
+    conf.args = ngx_array_create(pool, 10, sizeof(ngx_str_t));
     if (conf.args == NULL) {
         ngx_destroy_pool(pool);
         return NULL;
@@ -516,7 +525,7 @@ ngx_cycle_t *ngx_init_cycle(ngx_cycle_t 
 
     ngx_temp_pool->log = cycle->log;
 
-    old = ngx_push_array(&ngx_old_cycles);
+    old = ngx_array_push(&ngx_old_cycles);
     if (old == NULL) {
         exit(1);
     }
@@ -562,7 +571,7 @@ ngx_int_t ngx_create_pidfile(ngx_cycle_t
 {
     ngx_uint_t        trunc;
     size_t            len;
-    u_char           *name, pid[NGX_INT64_LEN];
+    u_char            pid[NGX_INT64_LEN];
     ngx_file_t        file;
     ngx_core_conf_t  *ccf, *old_ccf;