diff src/core/ngx_alloc.c @ 39:83fa61cd3d2f

nginx-0.0.1-2002-12-24-20:30:59 import
author Igor Sysoev <igor@sysoev.ru>
date Tue, 24 Dec 2002 17:30:59 +0000
parents 53cb81681040
children 5f6d848dcbef
line wrap: on
line diff
--- a/src/core/ngx_alloc.c
+++ b/src/core/ngx_alloc.c
@@ -12,11 +12,14 @@ void *ngx_alloc(size_t size, ngx_log_t *
     void *p;
 
     p = malloc(size);
-    if (p == NULL)
+    if (p == NULL) {
         ngx_log_error(NGX_LOG_EMERG, log, ngx_errno,
                       "malloc() %d bytes failed", size);
+    }
 
+#if (NGX_DEBUG_ALLOC)
     ngx_log_debug(log, "malloc: %08x:%d" _ p _ size);
+#endif
 
     return p;
 }
@@ -26,8 +29,9 @@ void *ngx_calloc(size_t size, ngx_log_t 
     void *p;
 
     p = ngx_alloc(size, log);
-    if (p)
+    if (p) {
         ngx_memzero(p, size);
+    }
 
     return p;
 }
@@ -53,16 +57,21 @@ void ngx_destroy_pool(ngx_pool_t *pool)
     ngx_pool_large_t  *l;
 
     for (l = pool->large; l; l = l->next) {
+#if (NGX_DEBUG_ALLOC)
         ngx_log_debug(pool->log, "free: %08x" _ l->alloc);
+#endif
         free(l->alloc);
     }
 
     for (p = pool, n = pool->next; /* void */; p = n, n = n->next) {
+#if (NGX_DEBUG_ALLOC)
         ngx_log_debug(pool->log, "free: %08x" _ p);
+#endif
         free(p);
 
-        if (n == NULL)
+        if (n == NULL) {
             break;
+        }
     }
 }
 
@@ -83,8 +92,9 @@ void *ngx_palloc(ngx_pool_t *pool, size_
                 return m;
             }
 
-            if (n == NULL)
+            if (n == NULL) {
                 break;
+            }
         }
 
         /* alloc new pool block */
@@ -107,8 +117,9 @@ void *ngx_palloc(ngx_pool_t *pool, size_
                     break;
                 }
 
-                if (last->next == NULL)
+                if (last->next == NULL) {
                     break;
+                }
             }
         }
 
@@ -138,8 +149,9 @@ void *ngx_pcalloc(ngx_pool_t *pool, size
     void *p;
 
     p = ngx_palloc(pool, size);
-    if (p)
+    if (p) {
         ngx_memzero(p, size);
+    }
 
     return p;
 }