diff src/core/ngx_palloc.c @ 178:87699398f955 NGINX_0_3_36

nginx 0.3.36 *) Feature: the ngx_http_addition_filter_module. *) Feature: the "proxy_pass" and "fastcgi_pass" directives may be used inside the "if" block. *) Feature: the "proxy_ignore_client_abort" and "fastcgi_ignore_client_abort" directives. *) Feature: the "$request_completion" variable. *) Feature: the ngx_http_perl_module supports the $r->request_method and $r->remote_addr. *) Feature: the ngx_http_ssi_module supports the "elif" command. *) Bugfix: the "\/" string in the expression of the "if" command of the ngx_http_ssi_module was treated incorrectly. *) Bugfix: in the regular expressions in the "if" command of the ngx_http_ssi_module. *) Bugfix: if the relative path was specified in the "client_body_temp_path", "proxy_temp_path", "fastcgi_temp_path", and "perl_modules" directives, then the directory was used relatively to a current path but not to a server prefix.
author Igor Sysoev <http://sysoev.ru>
date Wed, 05 Apr 2006 00:00:00 +0400
parents bb61aa162c6b
children 6ae1357b7b7c
line wrap: on
line diff
--- a/src/core/ngx_palloc.c
+++ b/src/core/ngx_palloc.c
@@ -86,7 +86,7 @@ ngx_palloc(ngx_pool_t *pool, size_t size
 {
     u_char            *m;
     ngx_pool_t        *p, *n;
-    ngx_pool_large_t  *large, *last;
+    ngx_pool_large_t  *large;
 
     if (size <= (size_t) NGX_MAX_ALLOC_FROM_POOL
         && size <= (size_t) (pool->end - (u_char *) pool)
@@ -134,34 +134,6 @@ ngx_palloc(ngx_pool_t *pool, size_t size
         return m;
     }
 
-    /* allocate a large block */
-
-    large = NULL;
-    last = NULL;
-
-    if (pool->large) {
-        for (last = pool->large; /* void */ ; last = last->next) {
-            if (last->alloc == NULL) {
-                large = last;
-                last = NULL;
-                break;
-            }
-
-            if (last->next == NULL) {
-                break;
-            }
-        }
-    }
-
-    if (large == NULL) {
-        large = ngx_palloc(pool, sizeof(ngx_pool_large_t));
-        if (large == NULL) {
-            return NULL;
-        }
-
-        large->next = NULL;
-    }
-
 #if 0
     p = ngx_memalign(ngx_pagesize, size, pool->log);
     if (p == NULL) {
@@ -174,14 +146,14 @@ ngx_palloc(ngx_pool_t *pool, size_t size
     }
 #endif
 
-    if (pool->large == NULL) {
-        pool->large = large;
-
-    } else if (last) {
-        last->next = large;
+    large = ngx_palloc(pool, sizeof(ngx_pool_large_t));
+    if (large == NULL) {
+        return NULL;
     }
 
     large->alloc = p;
+    large->next = pool->large;
+    pool->large = large;
 
     return p;
 }