small optimization

This commit is contained in:
Igor Sysoev 2008-06-20 20:57:40 +00:00
parent 0b5e77f416
commit 5a4c61658b

View File

@ -154,13 +154,19 @@ static void *
ngx_palloc_block(ngx_pool_t *pool, size_t size) ngx_palloc_block(ngx_pool_t *pool, size_t size)
{ {
u_char *m; u_char *m;
size_t psize;
ngx_pool_t *p, *new, *current; ngx_pool_t *p, *new, *current;
new = ngx_create_pool((size_t) (pool->d.end - (u_char *) pool), pool->log); psize = (size_t) (pool->d.end - (u_char *) pool);
new = ngx_alloc(size, pool->log);
if (new == NULL) { if (new == NULL) {
return NULL; return NULL;
} }
new->d.end = (u_char *) new + psize;
new->d.next = NULL;
current = pool->current; current = pool->current;
for (p = current; p->d.next; p = p->d.next) { for (p = current; p->d.next; p = p->d.next) {