Mercurial > hg > nginx-vendor-0-7
diff src/core/ngx_palloc.c @ 270:6eb1e38f0f1f NGINX_0_5_5
nginx 0.5.5
*) Change: the -v switch does not show compiler information any more.
*) Feature: the -V switch.
*) Feature: the "worker_rlimit_core" directive supports size in K, M,
and G.
*) Bugfix: the nginx.pm module now could be installed by an
unprivileged user.
*) Bugfix: a segmentation fault might occur if the $r->request_body or
$r->request_body_file methods were used.
*) Bugfix: the ppc platform specific bugs.
author | Igor Sysoev <http://sysoev.ru> |
---|---|
date | Sun, 24 Dec 2006 00:00:00 +0300 |
parents | 6ae1357b7b7c |
children | 704622b2528a |
line wrap: on
line diff
--- a/src/core/ngx_palloc.c +++ b/src/core/ngx_palloc.c @@ -85,14 +85,17 @@ void * ngx_palloc(ngx_pool_t *pool, size_t size) { u_char *m; - ngx_pool_t *p, *n; + ngx_pool_t *p, *n, *current; ngx_pool_large_t *large; if (size <= (size_t) NGX_MAX_ALLOC_FROM_POOL && size <= (size_t) (pool->end - (u_char *) pool) - (size_t) ngx_align_ptr(sizeof(ngx_pool_t), NGX_ALIGNMENT)) { - for (p = pool->current; /* void */ ; p = p->next) { + p = pool->current; + current = p; + + for ( ;; ) { if (size < sizeof(int) || (size & 1)) { m = p->last; @@ -108,12 +111,15 @@ ngx_palloc(ngx_pool_t *pool, size_t size } if ((size_t) (p->end - m) < NGX_ALIGNMENT) { - pool->current = p->next; + current = p->next; } if (p->next == NULL) { break; } + + p = p->next; + pool->current = current; } /* allocate a new pool block */ @@ -123,9 +129,7 @@ ngx_palloc(ngx_pool_t *pool, size_t size return NULL; } - if (pool->current == NULL) { - pool->current = n; - } + pool->current = current ? current : n; p->next = n; m = ngx_align_ptr(n->last, NGX_ALIGNMENT);