diff src/core/nginx.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 6cfc63e68377
children 0d75d65c642f
line wrap: on
line diff
--- a/src/core/nginx.c
+++ b/src/core/nginx.c
@@ -141,7 +141,8 @@ main(int argc, char *const *argv)
 
     ngx_pid = ngx_getpid();
 
-    if (!(log = ngx_log_init())) {
+    log = ngx_log_init();
+    if (log == NULL) {
         return 1;
     }
 
@@ -155,7 +156,8 @@ main(int argc, char *const *argv)
     init_cycle.log = log;
     ngx_cycle = &init_cycle;
 
-    if (!(init_cycle.pool = ngx_create_pool(1024, log))) {
+    init_cycle.pool = ngx_create_pool(1024, log);
+    if (init_cycle.pool == NULL) {
         return 1;
     }
 
@@ -255,9 +257,9 @@ main(int argc, char *const *argv)
 static ngx_int_t
 ngx_add_inherited_sockets(ngx_cycle_t *cycle)
 {
-    u_char              *p, *v, *inherited;
-    ngx_socket_t         s;
-    ngx_listening_t     *ls;
+    u_char           *p, *v, *inherited;
+    ngx_int_t         s;
+    ngx_listening_t  *ls;
 
     inherited = (u_char *) getenv(NGINX_VAR);
 
@@ -287,11 +289,12 @@ ngx_add_inherited_sockets(ngx_cycle_t *c
 
             v = p + 1;
 
-            if (!(ls = ngx_array_push(&cycle->listening))) {
+            ls = ngx_array_push(&cycle->listening);
+            if (ls == NULL) {
                 return NGX_ERROR;
             }
 
-            ls->fd = s;
+            ls->fd = (ngx_socket_t) s;
         }
     }
 
@@ -315,7 +318,7 @@ ngx_pid_t ngx_exec_new_binary(ngx_cycle_
     ctx.argv = argv;
 
     var = ngx_alloc(sizeof(NGINX_VAR)
-                            + cycle->listening.nelts * (NGX_INT32_LEN + 1) + 2,
+                    + cycle->listening.nelts * (NGX_INT32_LEN + 1) + 2,
                     cycle->log);
 
     p = ngx_cpymem(var, NGINX_VAR "=", sizeof(NGINX_VAR));
@@ -411,27 +414,29 @@ static ngx_int_t ngx_getopt(ngx_cycle_t 
 static ngx_int_t
 ngx_save_argv(ngx_cycle_t *cycle, int argc, char *const *argv)
 {
+#if (NGX_FREEBSD)
+
+    ngx_os_argv = (char **) argv;
+    ngx_argc = argc;
+    ngx_argv = (char **) argv;
+
+#else
     size_t     len;
     ngx_int_t  i;
 
     ngx_os_argv = (char **) argv;
-
     ngx_argc = argc;
 
-#if (NGX_FREEBSD)
-
-    ngx_argv = (char **) argv;
-
-#else
-
-    if (!(ngx_argv = ngx_alloc((argc + 1) * sizeof(char *), cycle->log))) {
+    ngx_argv = ngx_alloc((argc + 1) * sizeof(char *), cycle->log);
+    if (ngx_argv == NULL) {
         return NGX_ERROR;
     }
 
     for (i = 0; i < argc; i++) {
         len = ngx_strlen(argv[i]) + 1;
 
-        if (!(ngx_argv[i] = ngx_alloc(len, cycle->log))) {
+        ngx_argv[i] = ngx_alloc(len, cycle->log);
+        if (ngx_argv[i] == NULL) {
             return NGX_ERROR;
         }
 
@@ -451,7 +456,8 @@ ngx_core_module_create_conf(ngx_cycle_t 
 {
     ngx_core_conf_t  *ccf;
 
-    if (!(ccf = ngx_pcalloc(cycle->pool, sizeof(ngx_core_conf_t)))) {
+    ccf = ngx_pcalloc(cycle->pool, sizeof(ngx_core_conf_t));
+    if (ccf == NULL) {
         return NULL;
     }
 
@@ -534,7 +540,8 @@ ngx_core_module_init_conf(ngx_cycle_t *c
 
     ccf->newpid.len = ccf->pid.len + sizeof(NGX_NEWPID_EXT);
 
-    if (!(ccf->newpid.data = ngx_palloc(cycle->pool, ccf->newpid.len))) {
+    ccf->newpid.data = ngx_palloc(cycle->pool, ccf->newpid.len);
+    if (ccf->newpid.data == NULL) {
         return NGX_CONF_ERROR;
     }