# HG changeset patch # User Igor Sysoev # Date 1213714830 0 # Node ID 2a92804f4109a9b2678049903e7578297c65cd1a # Parent 824615f3b4ec866d33e78775ace80307f021f28b *) back out r2040 *) refactor ngx_palloc() *) introduce ngx_pnalloc() *) additional pool blocks have smaller header diff -r 824615f3b4ec -r 2a92804f4109 src/core/nginx.c --- a/src/core/nginx.c Mon Jun 16 09:11:12 2008 +0000 +++ b/src/core/nginx.c Tue Jun 17 15:00:30 2008 +0000 @@ -826,7 +826,7 @@ ccf->oldpid.len = ccf->pid.len + sizeof(NGX_OLDPID_EXT); - ccf->oldpid.data = ngx_palloc(cycle->pool, ccf->oldpid.len); + ccf->oldpid.data = ngx_pnalloc(cycle->pool, ccf->oldpid.len); if (ccf->oldpid.data == NULL) { return NGX_CONF_ERROR; } @@ -870,7 +870,7 @@ } else { cycle->lock_file.len = ccf->lock_file.len + 1; - cycle->lock_file.data = ngx_palloc(cycle->pool, + cycle->lock_file.data = ngx_pnalloc(cycle->pool, ccf->lock_file.len + sizeof(".accept")); if (cycle->lock_file.data == NULL) { return NGX_CONF_ERROR; diff -r 824615f3b4ec -r 2a92804f4109 src/core/ngx_array.c --- a/src/core/ngx_array.c Mon Jun 16 09:11:12 2008 +0000 +++ b/src/core/ngx_array.c Tue Jun 17 15:00:30 2008 +0000 @@ -39,12 +39,12 @@ p = a->pool; - if ((u_char *) a->elts + a->size * a->nalloc == p->last) { - p->last -= a->size * a->nalloc; + if ((u_char *) a->elts + a->size * a->nalloc == p->d.last) { + p->d.last -= a->size * a->nalloc; } - if ((u_char *) a + sizeof(ngx_array_t) == p->last) { - p->last = (u_char *) a; + if ((u_char *) a + sizeof(ngx_array_t) == p->d.last) { + p->d.last = (u_char *) a; } } @@ -64,14 +64,15 @@ p = a->pool; - if ((u_char *) a->elts + size == p->last && p->last + a->size <= p->end) + if ((u_char *) a->elts + size == p->d.last + && p->d.last + a->size <= p->d.end) { /* * the array allocation is the last in the pool * and there is space for new allocation */ - p->last += a->size; + p->d.last += a->size; a->nalloc++; } else { @@ -111,15 +112,15 @@ p = a->pool; - if ((u_char *) a->elts + a->size * a->nalloc == p->last - && p->last + size <= p->end) + if ((u_char *) a->elts + a->size * a->nalloc == p->d.last + && p->d.last + size <= p->d.end) { /* * the array allocation is the last in the pool * and there is space for new allocation */ - p->last += size; + p->d.last += size; a->nalloc += n; } else { diff -r 824615f3b4ec -r 2a92804f4109 src/core/ngx_conf_file.c --- a/src/core/ngx_conf_file.c Mon Jun 16 09:11:12 2008 +0000 +++ b/src/core/ngx_conf_file.c Tue Jun 17 15:00:30 2008 +0000 @@ -574,7 +574,7 @@ return NGX_ERROR; } - word->data = ngx_palloc(cf->pool, b->pos - start + 1); + word->data = ngx_pnalloc(cf->pool, b->pos - start + 1); if (word->data == NULL) { return NGX_ERROR; } @@ -726,7 +726,7 @@ } name->len = len + old.len; - name->data = ngx_palloc(cycle->pool, name->len + 1); + name->data = ngx_pnalloc(cycle->pool, name->len + 1); if (name->data == NULL) { return NGX_ERROR; } diff -r 824615f3b4ec -r 2a92804f4109 src/core/ngx_connection.c --- a/src/core/ngx_connection.c Mon Jun 16 09:11:12 2008 +0000 +++ b/src/core/ngx_connection.c Tue Jun 17 15:00:30 2008 +0000 @@ -36,7 +36,7 @@ sin->sin_port = htons(port); - ls->addr_text.data = ngx_palloc(cf->pool, + ls->addr_text.data = ngx_pnalloc(cf->pool, INET_ADDRSTRLEN - 1 + sizeof(":65535") - 1); if (ls->addr_text.data == NULL) { return NULL; @@ -106,8 +106,8 @@ ls[i].addr_text_max_len = INET_ADDRSTRLEN; - ls[i].addr_text.data = ngx_palloc(cycle->pool, INET_ADDRSTRLEN - 1 - + sizeof(":65535") - 1); + ls[i].addr_text.data = ngx_pnalloc(cycle->pool, + INET_ADDRSTRLEN - 1 + sizeof(":65535") - 1); if (ls[i].addr_text.data == NULL) { return NGX_ERROR; } diff -r 824615f3b4ec -r 2a92804f4109 src/core/ngx_cycle.c --- a/src/core/ngx_cycle.c Mon Jun 16 09:11:12 2008 +0000 +++ b/src/core/ngx_cycle.c Tue Jun 17 15:00:30 2008 +0000 @@ -81,7 +81,7 @@ cycle->conf_file.len = old_cycle->conf_file.len; - cycle->conf_file.data = ngx_palloc(pool, old_cycle->conf_file.len + 1); + cycle->conf_file.data = ngx_pnalloc(pool, old_cycle->conf_file.len + 1); if (cycle->conf_file.data == NULL) { ngx_destroy_pool(pool); return NULL; @@ -182,7 +182,7 @@ hostname[NGX_MAXHOSTNAMELEN - 1] = '\0'; cycle->hostname.len = ngx_strlen(hostname); - cycle->hostname.data = ngx_palloc(pool, cycle->hostname.len); + cycle->hostname.data = ngx_pnalloc(pool, cycle->hostname.len); if (cycle->hostname.data == NULL) { ngx_destroy_pool(pool); return NULL; @@ -460,8 +460,8 @@ #else - lock_file = ngx_palloc(cycle->pool, - cycle->lock_file.len + shm_zone[i].name.len); + lock_file = ngx_pnalloc(cycle->pool, + cycle->lock_file.len + shm_zone[i].name.len); if (lock_file == NULL) { goto failed; diff -r 824615f3b4ec -r 2a92804f4109 src/core/ngx_file.c --- a/src/core/ngx_file.c Mon Jun 16 09:11:12 2008 +0000 +++ b/src/core/ngx_file.c Tue Jun 17 15:00:30 2008 +0000 @@ -46,7 +46,7 @@ file->name.len = path->name.len + 1 + path->len + 10; - file->name.data = ngx_palloc(pool, file->name.len + 1); + file->name.data = ngx_pnalloc(pool, file->name.len + 1); if (file->name.data == NULL) { return NGX_ERROR; } diff -r 824615f3b4ec -r 2a92804f4109 src/core/ngx_hash.c --- a/src/core/ngx_hash.c Mon Jun 16 09:11:12 2008 +0000 +++ b/src/core/ngx_hash.c Tue Jun 17 15:00:30 2008 +0000 @@ -839,7 +839,7 @@ } name->len = last - 1; - name->data = ngx_palloc(ha->temp_pool, name->len); + name->data = ngx_pnalloc(ha->temp_pool, name->len); if (name->data == NULL) { return NGX_ERROR; } @@ -855,7 +855,7 @@ * and ".example.com" to "com.example\0" */ - p = ngx_palloc(ha->temp_pool, last); + p = ngx_pnalloc(ha->temp_pool, last); if (p == NULL) { return NGX_ERROR; } @@ -891,7 +891,7 @@ last++; - p = ngx_palloc(ha->temp_pool, last); + p = ngx_pnalloc(ha->temp_pool, last); if (p == NULL) { return NGX_ERROR; } @@ -944,7 +944,7 @@ } name->len = last - skip; - name->data = ngx_palloc(ha->temp_pool, name->len); + name->data = ngx_pnalloc(ha->temp_pool, name->len); if (name->data == NULL) { return NGX_ERROR; } diff -r 824615f3b4ec -r 2a92804f4109 src/core/ngx_inet.c --- a/src/core/ngx_inet.c Mon Jun 16 09:11:12 2008 +0000 +++ b/src/core/ngx_inet.c Tue Jun 17 15:00:30 2008 +0000 @@ -578,7 +578,7 @@ len = INET_ADDRSTRLEN - 1 + 1 + sizeof(":65536") - 1; - p = ngx_palloc(pool, len); + p = ngx_pnalloc(pool, len); if (p == NULL) { return NGX_ERROR; } @@ -614,7 +614,7 @@ u->addrs[0].sockaddr = (struct sockaddr *) sin; u->addrs[0].socklen = sizeof(struct sockaddr_in); - p = ngx_palloc(pool, u->host.len + sizeof(":65536") - 1); + p = ngx_pnalloc(pool, u->host.len + sizeof(":65536") - 1); if (p == NULL) { return NGX_ERROR; } diff -r 824615f3b4ec -r 2a92804f4109 src/core/ngx_palloc.c --- a/src/core/ngx_palloc.c Mon Jun 16 09:11:12 2008 +0000 +++ b/src/core/ngx_palloc.c Tue Jun 17 15:00:30 2008 +0000 @@ -8,6 +8,10 @@ #include +static void *ngx_palloc_block(ngx_pool_t *pool, size_t size); +static void *ngx_palloc_large(ngx_pool_t *pool, size_t size); + + ngx_pool_t * ngx_create_pool(size_t size, ngx_log_t *log) { @@ -18,11 +22,14 @@ return NULL; } - p->last = (u_char *) p + sizeof(ngx_pool_t); - p->end = (u_char *) p + size; + p->d.last = (u_char *) p + sizeof(ngx_pool_t); + p->d.end = (u_char *) p + size; + p->d.next = NULL; + + p->max = (size < NGX_MAX_ALLOC_FROM_POOL) ? size - sizeof(ngx_pool_t): + NGX_MAX_ALLOC_FROM_POOL; p->current = p; p->chain = NULL; - p->next = NULL; p->large = NULL; p->cleanup = NULL; p->log = log; @@ -62,9 +69,9 @@ * so we can not use this log while the free()ing the pool */ - for (p = pool, n = pool->next; /* void */; p = n, n = n->next) { + for (p = pool, n = pool->d.next; /* void */; p = n, n = n->d.next) { ngx_log_debug2(NGX_LOG_DEBUG_ALLOC, pool->log, 0, - "free: %p, unused: %uz", p, p->end - p->last); + "free: %p, unused: %uz", p, p->d.end - p->d.last); if (n == NULL) { break; @@ -73,7 +80,7 @@ #endif - for (p = pool, n = pool->next; /* void */; p = n, n = n->next) { + for (p = pool, n = pool->d.next; /* void */; p = n, n = n->d.next) { ngx_free(p); if (n == NULL) { @@ -86,65 +93,98 @@ void * ngx_palloc(ngx_pool_t *pool, size_t size) { - u_char *m; - ngx_pool_t *p, *n, *current; - ngx_pool_large_t *large; + u_char *m; + ngx_pool_t *p; - 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)) - { + if (size <= pool->max) { + p = pool->current; - current = p; - for ( ;; ) { + do { + m = ngx_align_ptr(p->d.last, NGX_ALIGNMENT); - /* - * allow non-aligned memory blocks for small allocations (1, 2, - * or 3 bytes) and for odd length strings (struct's have aligned - * size) - */ + if ((size_t) (p->d.end - m) >= size) { + p->d.last = m + size; - if (size < sizeof(int) || (size & 1)) { - m = p->last; - - } else { - m = ngx_align_ptr(p->last, NGX_ALIGNMENT); + return m; } - if ((size_t) (p->end - m) >= size) { - p->last = m + size; + p = p->d.next; + + } while (p); + + return ngx_palloc_block(pool, size); + } + + return ngx_palloc_large(pool, size); +} + + +void * +ngx_pnalloc(ngx_pool_t *pool, size_t size) +{ + u_char *m; + ngx_pool_t *p; + + if (size <= pool->max) { + + p = pool->current; + + do { + m = p->d.last; + + if ((size_t) (p->d.end - m) >= size) { + p->d.last = m + size; return m; } - if ((size_t) (p->end - m) < NGX_ALIGNMENT) { - current = p->next; - } + p = p->d.next; + + } while (p); + + return ngx_palloc_block(pool, size); + } + + return ngx_palloc_large(pool, size); +} + - if (p->next == NULL) { - break; - } +static void * +ngx_palloc_block(ngx_pool_t *pool, size_t size) +{ + u_char *m; + ngx_pool_t *p, *new, *current; - p = p->next; - pool->current = current; - } - - /* allocate a new pool block */ + new = ngx_create_pool((size_t) (pool->d.end - (u_char *) pool), pool->log); + if (new == NULL) { + return NULL; + } - n = ngx_create_pool((size_t) (p->end - (u_char *) p), p->log); - if (n == NULL) { - return NULL; + current = pool->current; + + for (p = current; p->d.next; p = p->d.next) { + if ((size_t) (p->d.end - p->d.last) < NGX_ALIGNMENT) { + current = p->d.next; } + } - pool->current = current ? current : n; + p->d.next = new; + + pool->current = current ? current : new; - p->next = n; - m = ngx_align_ptr(n->last, NGX_ALIGNMENT); - n->last = m + size; + m = (u_char *) new + sizeof(ngx_pool_data_t); + new->d.last = m + size; + + return m; +} - return m; - } + +static void * +ngx_palloc_large(ngx_pool_t *pool, size_t size) +{ + void *p; + ngx_pool_large_t *large; #if 0 p = ngx_memalign(ngx_pagesize, size, pool->log); @@ -172,17 +212,6 @@ } -void * -ngx_palloc_aligned(ngx_pool_t *pool, size_t size) -{ - if (size & 1) { - size++; - } - - return ngx_palloc(pool, size); -} - - ngx_int_t ngx_pfree(ngx_pool_t *pool, void *p) { diff -r 824615f3b4ec -r 2a92804f4109 src/core/ngx_palloc.h --- a/src/core/ngx_palloc.h Mon Jun 16 09:11:12 2008 +0000 +++ b/src/core/ngx_palloc.h Tue Jun 17 15:00:30 2008 +0000 @@ -43,12 +43,18 @@ }; -struct ngx_pool_s { +typedef struct { u_char *last; u_char *end; + ngx_pool_t *next; +} ngx_pool_data_t; + + +struct ngx_pool_s { + ngx_pool_data_t d; + size_t max; ngx_pool_t *current; ngx_chain_t *chain; - ngx_pool_t *next; ngx_pool_large_t *large; ngx_pool_cleanup_t *cleanup; ngx_log_t *log; @@ -69,7 +75,7 @@ void ngx_destroy_pool(ngx_pool_t *pool); void *ngx_palloc(ngx_pool_t *pool, size_t size); -void *ngx_palloc_aligned(ngx_pool_t *pool, size_t size); +void *ngx_pnalloc(ngx_pool_t *pool, size_t size); void *ngx_pcalloc(ngx_pool_t *pool, size_t size); ngx_int_t ngx_pfree(ngx_pool_t *pool, void *p); diff -r 824615f3b4ec -r 2a92804f4109 src/core/ngx_regex.c --- a/src/core/ngx_regex.c Mon Jun 16 09:11:12 2008 +0000 +++ b/src/core/ngx_regex.c Tue Jun 17 15:00:30 2008 +0000 @@ -165,7 +165,7 @@ #endif if (pool) { - return ngx_palloc_aligned(pool, size); + return ngx_palloc(pool, size); } return NULL; diff -r 824615f3b4ec -r 2a92804f4109 src/core/ngx_string.c --- a/src/core/ngx_string.c Mon Jun 16 09:11:12 2008 +0000 +++ b/src/core/ngx_string.c Tue Jun 17 15:00:30 2008 +0000 @@ -34,7 +34,7 @@ { u_char *dst; - dst = ngx_palloc(pool, src->len); + dst = ngx_pnalloc(pool, src->len); if (dst == NULL) { return NULL; } diff -r 824615f3b4ec -r 2a92804f4109 src/event/ngx_event_accept.c --- a/src/event/ngx_event_accept.c Mon Jun 16 09:11:12 2008 +0000 +++ b/src/event/ngx_event_accept.c Tue Jun 17 15:00:30 2008 +0000 @@ -201,7 +201,7 @@ #endif if (ls->addr_ntop) { - c->addr_text.data = ngx_palloc(c->pool, ls->addr_text_max_len); + c->addr_text.data = ngx_pnalloc(c->pool, ls->addr_text_max_len); if (c->addr_text.data == NULL) { ngx_close_accepted_connection(c); return; diff -r 824615f3b4ec -r 2a92804f4109 src/event/ngx_event_acceptex.c --- a/src/event/ngx_event_acceptex.c Mon Jun 16 09:11:12 2008 +0000 +++ b/src/event/ngx_event_acceptex.c Tue Jun 17 15:00:30 2008 +0000 @@ -58,8 +58,8 @@ } if (c->listening->addr_ntop) { - c->addr_text.data = ngx_palloc(c->pool, - c->listening->addr_text_max_len); + c->addr_text.data = ngx_pnalloc(c->pool, + c->listening->addr_text_max_len); if (c->addr_text.data == NULL) { /* TODO: close socket */ return; diff -r 824615f3b4ec -r 2a92804f4109 src/event/ngx_event_openssl.c --- a/src/event/ngx_event_openssl.c Mon Jun 16 09:11:12 2008 +0000 +++ b/src/event/ngx_event_openssl.c Tue Jun 17 15:00:30 2008 +0000 @@ -1907,7 +1907,7 @@ len = BIO_pending(bio); s->len = len; - s->data = ngx_palloc(pool, len); + s->data = ngx_pnalloc(pool, len); if (s->data == NULL) { goto failed; } @@ -1954,7 +1954,7 @@ for (len = 0; p[len]; len++) { /* void */ } s->len = len; - s->data = ngx_palloc(pool, len); + s->data = ngx_pnalloc(pool, len); if (s->data == NULL) { OPENSSL_free(p); X509_free(cert); @@ -1996,7 +1996,7 @@ for (len = 0; p[len]; len++) { /* void */ } s->len = len; - s->data = ngx_palloc(pool, len); + s->data = ngx_pnalloc(pool, len); if (s->data == NULL) { OPENSSL_free(p); X509_free(cert); @@ -2036,7 +2036,7 @@ len = BIO_pending(bio); s->len = len; - s->data = ngx_palloc(pool, len); + s->data = ngx_pnalloc(pool, len); if (s->data == NULL) { BIO_free(bio); X509_free(cert); diff -r 824615f3b4ec -r 2a92804f4109 src/http/modules/ngx_http_auth_basic_module.c --- a/src/http/modules/ngx_http_auth_basic_module.c Mon Jun 16 09:11:12 2008 +0000 +++ b/src/http/modules/ngx_http_auth_basic_module.c Tue Jun 17 15:00:30 2008 +0000 @@ -232,7 +232,7 @@ if (state == sw_passwd) { pwd.len = i - passwd; - pwd.data = ngx_palloc(r->pool, pwd.len + 1); + pwd.data = ngx_pnalloc(r->pool, pwd.len + 1); if (pwd.data == NULL) { return NGX_HTTP_INTERNAL_SERVER_ERROR; } @@ -400,7 +400,7 @@ len = sizeof("Basic realm=\"") - 1 + realm->len + 1; - basic = ngx_palloc(cf->pool, len); + basic = ngx_pnalloc(cf->pool, len); if (basic == NULL) { return NGX_CONF_ERROR; } diff -r 824615f3b4ec -r 2a92804f4109 src/http/modules/ngx_http_autoindex_module.c --- a/src/http/modules/ngx_http_autoindex_module.c Mon Jun 16 09:11:12 2008 +0000 +++ b/src/http/modules/ngx_http_autoindex_module.c Tue Jun 17 15:00:30 2008 +0000 @@ -282,7 +282,7 @@ allocated = path.len + 1 + len + 1 + NGX_HTTP_AUTOINDEX_PREALLOCATE; - filename = ngx_palloc(pool, allocated); + filename = ngx_pnalloc(pool, allocated); if (filename == NULL) { return ngx_http_autoindex_error(r, &dir, &path); } @@ -318,7 +318,7 @@ entry->name.len = len; - entry->name.data = ngx_palloc(pool, len + 1); + entry->name.data = ngx_pnalloc(pool, len + 1); if (entry->name.data == NULL) { return ngx_http_autoindex_error(r, &dir, &path); } diff -r 824615f3b4ec -r 2a92804f4109 src/http/modules/ngx_http_dav_module.c --- a/src/http/modules/ngx_http_dav_module.c Mon Jun 16 09:11:12 2008 +0000 +++ b/src/http/modules/ngx_http_dav_module.c Tue Jun 17 15:00:30 2008 +0000 @@ -1102,7 +1102,7 @@ location = path + clcf->root.len; } else { - location = ngx_palloc(r->pool, r->uri.len); + location = ngx_pnalloc(r->pool, r->uri.len); if (location == NULL) { return NGX_ERROR; } diff -r 824615f3b4ec -r 2a92804f4109 src/http/modules/ngx_http_fastcgi_module.c --- a/src/http/modules/ngx_http_fastcgi_module.c Mon Jun 16 09:11:12 2008 +0000 +++ b/src/http/modules/ngx_http_fastcgi_module.c Tue Jun 17 15:00:30 2008 +0000 @@ -1059,7 +1059,7 @@ size += part[i].end - part[i].start; } - p = ngx_palloc(r->pool, size); + p = ngx_pnalloc(r->pool, size); if (p == NULL) { return NGX_ERROR; } @@ -1087,7 +1087,7 @@ h->value.data = r->header_start; h->value.data[h->value.len] = '\0'; - h->lowcase_key = ngx_palloc(r->pool, h->key.len); + h->lowcase_key = ngx_pnalloc(r->pool, h->key.len); if (h->lowcase_key == NULL) { return NGX_ERROR; } @@ -1097,9 +1097,9 @@ h->key.len = r->header_name_end - r->header_name_start; h->value.len = r->header_end - r->header_start; - h->key.data = ngx_palloc(r->pool, - h->key.len + 1 + h->value.len + 1 - + h->key.len); + h->key.data = ngx_pnalloc(r->pool, + h->key.len + 1 + h->value.len + 1 + + h->key.len); if (h->key.data == NULL) { return NGX_ERROR; } @@ -2015,7 +2015,7 @@ v->len = r->uri.len + flcf->index.len; - v->data = ngx_palloc(r->pool, v->len); + v->data = ngx_pnalloc(r->pool, v->len); if (v->data == NULL) { return NGX_ERROR; } diff -r 824615f3b4ec -r 2a92804f4109 src/http/modules/ngx_http_gzip_filter_module.c --- a/src/http/modules/ngx_http_gzip_filter_module.c Mon Jun 16 09:11:12 2008 +0000 +++ b/src/http/modules/ngx_http_gzip_filter_module.c Tue Jun 17 15:00:30 2008 +0000 @@ -802,7 +802,7 @@ return NGX_OK; } - v->data = ngx_palloc(r->pool, NGX_INT32_LEN + 3); + v->data = ngx_pnalloc(r->pool, NGX_INT32_LEN + 3); if (v->data == NULL) { return NGX_ERROR; } @@ -951,7 +951,7 @@ type->len = value[i].len; - type->data = ngx_palloc(cf->pool, type->len + 1); + type->data = ngx_pnalloc(cf->pool, type->len + 1); if (type->data == NULL) { return NGX_CONF_ERROR; } diff -r 824615f3b4ec -r 2a92804f4109 src/http/modules/ngx_http_headers_filter_module.c --- a/src/http/modules/ngx_http_headers_filter_module.c Mon Jun 16 09:11:12 2008 +0000 +++ b/src/http/modules/ngx_http_headers_filter_module.c Tue Jun 17 15:00:30 2008 +0000 @@ -264,7 +264,7 @@ return NGX_OK; } - expires->value.data = ngx_palloc(r->pool, len); + expires->value.data = ngx_pnalloc(r->pool, len); if (expires->value.data == NULL) { return NGX_ERROR; } @@ -297,8 +297,8 @@ return NGX_OK; } - cc->value.data = ngx_palloc(r->pool, - sizeof("max-age=") + NGX_TIME_T_LEN + 1); + cc->value.data = ngx_pnalloc(r->pool, + sizeof("max-age=") + NGX_TIME_T_LEN + 1); if (cc->value.data == NULL) { return NGX_ERROR; } diff -r 824615f3b4ec -r 2a92804f4109 src/http/modules/ngx_http_index_module.c --- a/src/http/modules/ngx_http_index_module.c Mon Jun 16 09:11:12 2008 +0000 +++ b/src/http/modules/ngx_http_index_module.c Tue Jun 17 15:00:30 2008 +0000 @@ -254,7 +254,7 @@ uri.data = path.data + root; } else { - uri.data = ngx_palloc(r->pool, uri.len); + uri.data = ngx_pnalloc(r->pool, uri.len); if (uri.data == NULL) { return NGX_HTTP_INTERNAL_SERVER_ERROR; } diff -r 824615f3b4ec -r 2a92804f4109 src/http/modules/ngx_http_log_module.c --- a/src/http/modules/ngx_http_log_module.c Mon Jun 16 09:11:12 2008 +0000 +++ b/src/http/modules/ngx_http_log_module.c Tue Jun 17 15:00:30 2008 +0000 @@ -261,7 +261,7 @@ } } - line = ngx_palloc(r->pool, len); + line = ngx_pnalloc(r->pool, len); if (line == NULL) { return NGX_ERROR; } @@ -970,7 +970,7 @@ } else { op->run = ngx_http_log_copy_long; - p = ngx_palloc(cf->pool, len); + p = ngx_pnalloc(cf->pool, len); if (p == NULL) { return NGX_CONF_ERROR; } diff -r 824615f3b4ec -r 2a92804f4109 src/http/modules/ngx_http_map_module.c --- a/src/http/modules/ngx_http_map_module.c Mon Jun 16 09:11:12 2008 +0000 +++ b/src/http/modules/ngx_http_map_module.c Tue Jun 17 15:00:30 2008 +0000 @@ -130,7 +130,7 @@ return NGX_OK; } - name = ngx_palloc(r->pool, len); + name = ngx_pnalloc(r->pool, len); if (name == NULL) { return NGX_ERROR; } diff -r 824615f3b4ec -r 2a92804f4109 src/http/modules/ngx_http_proxy_module.c --- a/src/http/modules/ngx_http_proxy_module.c Mon Jun 16 09:11:12 2008 +0000 +++ b/src/http/modules/ngx_http_proxy_module.c Tue Jun 17 15:00:30 2008 +0000 @@ -964,8 +964,8 @@ u->state->status = ctx->status; u->headers_in.status_line.len = ctx->status_end - ctx->status_start; - u->headers_in.status_line.data = ngx_palloc(r->pool, - u->headers_in.status_line.len); + u->headers_in.status_line.data = ngx_pnalloc(r->pool, + u->headers_in.status_line.len); if (u->headers_in.status_line.data == NULL) { return NGX_ERROR; } @@ -1220,7 +1220,7 @@ h->key.len = r->header_name_end - r->header_name_start; h->value.len = r->header_end - r->header_start; - h->key.data = ngx_palloc(r->pool, + h->key.data = ngx_pnalloc(r->pool, h->key.len + 1 + h->value.len + 1 + h->key.len); if (h->key.data == NULL) { return NGX_ERROR; @@ -1400,7 +1400,7 @@ v->len = r->headers_in.x_forwarded_for->value.len + sizeof(", ") - 1 + r->connection->addr_text.len; - p = ngx_palloc(r->pool, v->len); + p = ngx_pnalloc(r->pool, v->len); if (p == NULL) { return NGX_ERROR; } @@ -1435,7 +1435,7 @@ v->no_cacheable = 0; v->not_found = 0; - v->data = ngx_palloc(r->connection->pool, NGX_SIZE_T_LEN); + v->data = ngx_pnalloc(r->connection->pool, NGX_SIZE_T_LEN); if (v->data == NULL) { return NGX_ERROR; @@ -1492,7 +1492,7 @@ len = prefix + pr->replacement.text.len + h->value.len - pr->redirect.len; - data = ngx_palloc(r->pool, len); + data = ngx_pnalloc(r->pool, len); if (data == NULL) { return NGX_ERROR; } @@ -1544,7 +1544,7 @@ len += lcode(&e); } - data = ngx_palloc(r->pool, len); + data = ngx_pnalloc(r->pool, len); if (data == NULL) { return NGX_ERROR; } diff -r 824615f3b4ec -r 2a92804f4109 src/http/modules/ngx_http_range_filter_module.c --- a/src/http/modules/ngx_http_range_filter_module.c Mon Jun 16 09:11:12 2008 +0000 +++ b/src/http/modules/ngx_http_range_filter_module.c Tue Jun 17 15:00:30 2008 +0000 @@ -307,7 +307,7 @@ content_range->key.len = sizeof("Content-Range") - 1; content_range->key.data = (u_char *) "Content-Range"; - content_range->value.data = ngx_palloc(r->pool, + content_range->value.data = ngx_pnalloc(r->pool, sizeof("bytes */") - 1 + NGX_OFF_T_LEN); if (content_range->value.data == NULL) { return NGX_ERROR; @@ -341,7 +341,7 @@ content_range->key.data = (u_char *) "Content-Range"; content_range->value.data = - ngx_palloc(r->pool, sizeof("bytes -/") - 1 + 3 * NGX_OFF_T_LEN); + ngx_pnalloc(r->pool, sizeof("bytes -/") - 1 + 3 * NGX_OFF_T_LEN); if (content_range->value.data == NULL) { return NGX_ERROR; } @@ -376,7 +376,7 @@ len += sizeof("; charset=") - 1 + r->headers_out.charset.len; } - ctx->boundary_header.data = ngx_palloc(r->pool, len); + ctx->boundary_header.data = ngx_pnalloc(r->pool, len); if (ctx->boundary_header.data == NULL) { return NGX_ERROR; } @@ -414,9 +414,9 @@ } r->headers_out.content_type.data = - ngx_palloc(r->pool, - sizeof("Content-Type: multipart/byteranges; boundary=") - 1 - + NGX_ATOMIC_T_LEN); + ngx_pnalloc(r->pool, + sizeof("Content-Type: multipart/byteranges; boundary=") - 1 + + NGX_ATOMIC_T_LEN); if (r->headers_out.content_type.data == NULL) { return NGX_ERROR; @@ -441,7 +441,7 @@ /* the size of the range: "SSSS-EEEE/TTTT" CRLF CRLF */ range[i].content_range.data = - ngx_palloc(r->pool, 3 * NGX_OFF_T_LEN + 2 + 4); + ngx_pnalloc(r->pool, 3 * NGX_OFF_T_LEN + 2 + 4); if (range[i].content_range.data == NULL) { return NGX_ERROR; @@ -649,8 +649,8 @@ b->temporary = 1; b->last_buf = 1; - b->pos = ngx_palloc(r->pool, sizeof(CRLF "--") - 1 + NGX_ATOMIC_T_LEN - + sizeof("--" CRLF) - 1); + b->pos = ngx_pnalloc(r->pool, sizeof(CRLF "--") - 1 + NGX_ATOMIC_T_LEN + + sizeof("--" CRLF) - 1); if (b->pos == NULL) { return NGX_ERROR; } diff -r 824615f3b4ec -r 2a92804f4109 src/http/modules/ngx_http_realip_module.c --- a/src/http/modules/ngx_http_realip_module.c Mon Jun 16 09:11:12 2008 +0000 +++ b/src/http/modules/ngx_http_realip_module.c Tue Jun 17 15:00:30 2008 +0000 @@ -163,7 +163,7 @@ return NGX_DECLINED; } - p = ngx_palloc(r->connection->pool, len); + p = ngx_pnalloc(r->connection->pool, len); if (p == NULL) { return NGX_HTTP_INTERNAL_SERVER_ERROR; } diff -r 824615f3b4ec -r 2a92804f4109 src/http/modules/ngx_http_ssi_filter_module.c --- a/src/http/modules/ngx_http_ssi_filter_module.c Mon Jun 16 09:11:12 2008 +0000 +++ b/src/http/modules/ngx_http_ssi_filter_module.c Tue Jun 17 15:00:30 2008 +0000 @@ -1151,8 +1151,8 @@ default: ctx->command.len = 1; - ctx->command.data = ngx_palloc(r->pool, - NGX_HTTP_SSI_COMMAND_LEN); + ctx->command.data = ngx_pnalloc(r->pool, + NGX_HTTP_SSI_COMMAND_LEN); if (ctx->command.data == NULL) { return NGX_ERROR; } @@ -1218,8 +1218,8 @@ } ctx->param->key.len = 1; - ctx->param->key.data = ngx_palloc(r->pool, - NGX_HTTP_SSI_PARAM_LEN); + ctx->param->key.data = ngx_pnalloc(r->pool, + NGX_HTTP_SSI_PARAM_LEN); if (ctx->param->key.data == NULL) { return NGX_ERROR; } @@ -1229,8 +1229,8 @@ ctx->param->value.len = 0; if (ctx->value_buf == NULL) { - ctx->param->value.data = ngx_palloc(r->pool, - ctx->value_len); + ctx->param->value.data = ngx_pnalloc(r->pool, + ctx->value_len); if (ctx->param->value.data == NULL) { return NGX_ERROR; } @@ -1408,7 +1408,7 @@ case ssi_postparam_state: if (ctx->param->value.len + 1 < ctx->value_len / 2) { - value = ngx_palloc(r->pool, ctx->param->value.len + 1); + value = ngx_pnalloc(r->pool, ctx->param->value.len + 1); if (value == NULL) { return NGX_ERROR; } @@ -1626,7 +1626,7 @@ if (prefix) { len = prefix + text->len; - data = ngx_palloc(r->pool, len); + data = ngx_pnalloc(r->pool, len); if (data == NULL) { return NGX_ERROR; } @@ -1829,7 +1829,7 @@ } } - p = ngx_palloc(r->pool, len + ((flags & NGX_HTTP_SSI_ADD_ZERO) ? 1 : 0)); + p = ngx_pnalloc(r->pool, len + ((flags & NGX_HTTP_SSI_ADD_ZERO) ? 1 : 0)); if (p == NULL) { return NGX_ERROR; } @@ -2222,7 +2222,7 @@ NGX_ESCAPE_HTML); if (len) { - p = ngx_palloc(r->pool, value->len + len); + p = ngx_pnalloc(r->pool, value->len + len); if (p == NULL) { return NGX_HTTP_SSI_ERROR; } @@ -2239,7 +2239,7 @@ len = ngx_escape_html(NULL, value->data, value->len); if (len) { - p = ngx_palloc(r->pool, value->len + len); + p = ngx_pnalloc(r->pool, value->len + len); if (p == NULL) { return NGX_HTTP_SSI_ERROR; } @@ -2286,7 +2286,7 @@ if (value) { ctx->timefmt.len = value->len; - ctx->timefmt.data = ngx_palloc(r->pool, value->len + 1); + ctx->timefmt.data = ngx_pnalloc(r->pool, value->len + 1); if (ctx->timefmt.data == NULL) { return NGX_HTTP_SSI_ERROR; } @@ -2666,7 +2666,7 @@ || (ctx->timefmt.len == sizeof("%s") - 1 && ctx->timefmt.data[0] == '%' && ctx->timefmt.data[1] == 's')) { - v->data = ngx_palloc(r->pool, NGX_TIME_T_LEN); + v->data = ngx_pnalloc(r->pool, NGX_TIME_T_LEN); if (v->data == NULL) { return NGX_ERROR; } @@ -2689,7 +2689,7 @@ return NGX_ERROR; } - v->data = ngx_palloc(r->pool, v->len); + v->data = ngx_pnalloc(r->pool, v->len); if (v->data == NULL) { return NGX_ERROR; } @@ -2738,7 +2738,7 @@ type->len = value[i].len; - type->data = ngx_palloc(cf->pool, type->len + 1); + type->data = ngx_pnalloc(cf->pool, type->len + 1); if (type->data == NULL) { return NGX_CONF_ERROR; } diff -r 824615f3b4ec -r 2a92804f4109 src/http/modules/ngx_http_static_module.c --- a/src/http/modules/ngx_http_static_module.c Mon Jun 16 09:11:12 2008 +0000 +++ b/src/http/modules/ngx_http_static_module.c Tue Jun 17 15:00:30 2008 +0000 @@ -162,7 +162,7 @@ len += r->args.len + 1; } - location = ngx_palloc(r->pool, len); + location = ngx_pnalloc(r->pool, len); if (location == NULL) { return NGX_HTTP_INTERNAL_SERVER_ERROR; } diff -r 824615f3b4ec -r 2a92804f4109 src/http/modules/ngx_http_sub_filter_module.c --- a/src/http/modules/ngx_http_sub_filter_module.c Mon Jun 16 09:11:12 2008 +0000 +++ b/src/http/modules/ngx_http_sub_filter_module.c Tue Jun 17 15:00:30 2008 +0000 @@ -710,7 +710,7 @@ type->len = value[i].len; - type->data = ngx_palloc(cf->pool, type->len + 1); + type->data = ngx_pnalloc(cf->pool, type->len + 1); if (type->data == NULL) { return NGX_CONF_ERROR; } diff -r 824615f3b4ec -r 2a92804f4109 src/http/modules/ngx_http_userid_filter_module.c --- a/src/http/modules/ngx_http_userid_filter_module.c Mon Jun 16 09:11:12 2008 +0000 +++ b/src/http/modules/ngx_http_userid_filter_module.c Tue Jun 17 15:00:30 2008 +0000 @@ -420,7 +420,7 @@ len += conf->domain.len; } - cookie = ngx_palloc(r->pool, len); + cookie = ngx_pnalloc(r->pool, len); if (cookie == NULL) { return NGX_ERROR; } @@ -496,7 +496,7 @@ ngx_str_t *name, uint32_t *uid) { v->len = name->len + sizeof("=00001111222233334444555566667777") - 1; - v->data = ngx_palloc(r->pool, v->len); + v->data = ngx_pnalloc(r->pool, v->len); if (v->data == NULL) { return NGX_ERROR; } @@ -620,7 +620,7 @@ return NGX_CONF_OK; } - new = ngx_palloc(cf->pool, sizeof("; domain=") - 1 + domain->len); + new = ngx_pnalloc(cf->pool, sizeof("; domain=") - 1 + domain->len); if (new == NULL) { return NGX_CONF_ERROR; } @@ -642,7 +642,7 @@ u_char *p, *new; - new = ngx_palloc(cf->pool, sizeof("; path=") - 1 + path->len); + new = ngx_pnalloc(cf->pool, sizeof("; path=") - 1 + path->len); if (new == NULL) { return NGX_CONF_ERROR; } diff -r 824615f3b4ec -r 2a92804f4109 src/http/modules/perl/nginx.xs --- a/src/http/modules/perl/nginx.xs Mon Jun 16 09:11:12 2008 +0000 +++ b/src/http/modules/perl/nginx.xs Tue Jun 17 15:00:30 2008 +0000 @@ -48,7 +48,7 @@ return NGX_OK; } - s->data = ngx_palloc(r->pool, len); + s->data = ngx_pnalloc(r->pool, len); if (s->data == NULL) { return NGX_ERROR; } @@ -242,7 +242,7 @@ /* look up hashed headers */ - lowcase_key = ngx_palloc(r->pool, len); + lowcase_key = ngx_pnalloc(r->pool, len); if (lowcase_key == NULL) { XSRETURN_UNDEF; } @@ -293,7 +293,7 @@ size += ph[i]->value.len + sizeof("; ") - 1; } - cookie = ngx_palloc(r->pool, size); + cookie = ngx_pnalloc(r->pool, size); if (cookie == NULL) { XSRETURN_UNDEF; } @@ -769,7 +769,7 @@ src = (u_char *) SvPV(text, len); - p = ngx_palloc(r->pool, len + 1); + p = ngx_pnalloc(r->pool, len + 1); if (p == NULL) { XSRETURN_UNDEF; } @@ -826,7 +826,7 @@ p = (u_char *) SvPV(name, len); - lowcase = ngx_palloc(r->pool, len); + lowcase = ngx_pnalloc(r->pool, len); if (lowcase == NULL) { XSRETURN_UNDEF; } diff -r 824615f3b4ec -r 2a92804f4109 src/http/modules/perl/ngx_http_perl_module.c --- a/src/http/modules/perl/ngx_http_perl_module.c Mon Jun 16 09:11:12 2008 +0000 +++ b/src/http/modules/perl/ngx_http_perl_module.c Tue Jun 17 15:00:30 2008 +0000 @@ -703,7 +703,7 @@ line = SvPVx(POPs, n_a); rv->len = n_a; - rv->data = ngx_palloc(r->pool, n_a); + rv->data = ngx_pnalloc(r->pool, n_a); if (rv->data == NULL) { return NGX_ERROR; } diff -r 824615f3b4ec -r 2a92804f4109 src/http/ngx_http.c --- a/src/http/ngx_http.c Mon Jun 16 09:11:12 2008 +0000 +++ b/src/http/ngx_http.c Tue Jun 17 15:00:30 2008 +0000 @@ -1024,8 +1024,8 @@ lq = (ngx_http_location_queue_t *) q; len = lq->name->len - prefix; - node = ngx_palloc_aligned(cf->pool, - offsetof(ngx_http_location_tree_node_t, name) + len); + node = ngx_palloc(cf->pool, + offsetof(ngx_http_location_tree_node_t, name) + len); if (node == NULL) { return NULL; } @@ -1615,7 +1615,7 @@ hip->port = in_port->port; - hip->port_text.data = ngx_palloc(cf->pool, 7); + hip->port_text.data = ngx_pnalloc(cf->pool, 7); if (hip->port_text.data == NULL) { return NGX_ERROR; } diff -r 824615f3b4ec -r 2a92804f4109 src/http/ngx_http_core_module.c --- a/src/http/ngx_http_core_module.c Mon Jun 16 09:11:12 2008 +0000 +++ b/src/http/ngx_http_core_module.c Tue Jun 17 15:00:30 2008 +0000 @@ -832,7 +832,7 @@ } else { len = clcf->name.len + 1 + r->args.len; - p = ngx_palloc(r->pool, len); + p = ngx_pnalloc(r->pool, len); if (p == NULL) { ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR); @@ -1267,7 +1267,7 @@ if (c >= 'A' && c <= 'Z') { - p = ngx_palloc(r->pool, r->exten.len); + p = ngx_pnalloc(r->pool, r->exten.len); if (p == NULL) { return NGX_HTTP_INTERNAL_SERVER_ERROR; } @@ -1390,7 +1390,7 @@ path->len = clcf->root.len + reserved; - path->data = ngx_palloc(r->pool, path->len); + path->data = ngx_pnalloc(r->pool, path->len); if (path->data == NULL) { return NULL; } @@ -1460,7 +1460,7 @@ } auth.len = ngx_base64_decoded_length(encoded.len); - auth.data = ngx_palloc(r->pool, auth.len + 1); + auth.data = ngx_pnalloc(r->pool, auth.len + 1); if (auth.data == NULL) { return NGX_ERROR; } diff -r 824615f3b4ec -r 2a92804f4109 src/http/ngx_http_request.c --- a/src/http/ngx_http_request.c Mon Jun 16 09:11:12 2008 +0000 +++ b/src/http/ngx_http_request.c Tue Jun 17 15:00:30 2008 +0000 @@ -654,7 +654,7 @@ if (r->complex_uri || r->quoted_uri) { - r->uri.data = ngx_palloc(r->pool, r->uri.len + 1); + r->uri.data = ngx_pnalloc(r->pool, r->uri.len + 1); if (r->uri.data == NULL) { ngx_http_close_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR); return; @@ -914,7 +914,7 @@ h->value.data = r->header_start; h->value.data[h->value.len] = '\0'; - h->lowcase_key = ngx_palloc(r->pool, h->key.len); + h->lowcase_key = ngx_pnalloc(r->pool, h->key.len); if (h->lowcase_key == NULL) { ngx_http_close_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR); return; @@ -1562,7 +1562,7 @@ server = buf; } else { - server = ngx_palloc(r->pool, len); + server = ngx_pnalloc(r->pool, len); if (server == NULL) { return NGX_ERROR; } diff -r 824615f3b4ec -r 2a92804f4109 src/http/ngx_http_script.c --- a/src/http/ngx_http_script.c Mon Jun 16 09:11:12 2008 +0000 +++ b/src/http/ngx_http_script.c Tue Jun 17 15:00:30 2008 +0000 @@ -341,7 +341,7 @@ value->len = len; - value->data = ngx_palloc(r->pool, len); + value->data = ngx_pnalloc(r->pool, len); if (value->data == NULL) { return NULL; } @@ -733,7 +733,7 @@ e->buf.len += r->args.len + 1; } - e->buf.data = ngx_palloc(r->pool, e->buf.len); + e->buf.data = ngx_pnalloc(r->pool, e->buf.len); if (e->buf.data == NULL) { e->ip = ngx_http_script_exit; e->status = NGX_HTTP_INTERNAL_SERVER_ERROR; @@ -1120,7 +1120,7 @@ } e->buf.len = len; - e->buf.data = ngx_palloc(e->request->pool, len); + e->buf.data = ngx_pnalloc(e->request->pool, len); if (e->buf.data == NULL) { e->ip = ngx_http_script_exit; e->status = NGX_HTTP_INTERNAL_SERVER_ERROR; diff -r 824615f3b4ec -r 2a92804f4109 src/http/ngx_http_upstream.c --- a/src/http/ngx_http_upstream.c Mon Jun 16 09:11:12 2008 +0000 +++ b/src/http/ngx_http_upstream.c Tue Jun 17 15:00:30 2008 +0000 @@ -2817,7 +2817,7 @@ } } - p = ngx_palloc(r->pool, len); + p = ngx_pnalloc(r->pool, len); if (p == NULL) { return NGX_ERROR; } @@ -2878,7 +2878,7 @@ len = r->upstream_states->nelts * (3 + 2); - p = ngx_palloc(r->pool, len); + p = ngx_pnalloc(r->pool, len); if (p == NULL) { return NGX_ERROR; } @@ -2944,7 +2944,7 @@ len = r->upstream_states->nelts * (NGX_TIME_T_LEN + 4 + 2); - p = ngx_palloc(r->pool, len); + p = ngx_pnalloc(r->pool, len); if (p == NULL) { return NGX_ERROR; } diff -r 824615f3b4ec -r 2a92804f4109 src/http/ngx_http_upstream_round_robin.c --- a/src/http/ngx_http_upstream_round_robin.c Mon Jun 16 09:11:12 2008 +0000 +++ b/src/http/ngx_http_upstream_round_robin.c Tue Jun 17 15:00:30 2008 +0000 @@ -283,7 +283,7 @@ len = INET_ADDRSTRLEN - 1 + 1 + sizeof(":65536") - 1; - p = ngx_palloc(r->pool, len); + p = ngx_pnalloc(r->pool, len); if (p == NULL) { return NGX_ERROR; } diff -r 824615f3b4ec -r 2a92804f4109 src/http/ngx_http_variables.c --- a/src/http/ngx_http_variables.c Mon Jun 16 09:11:12 2008 +0000 +++ b/src/http/ngx_http_variables.c Tue Jun 17 15:00:30 2008 +0000 @@ -272,7 +272,7 @@ } v->name.len = name->len; - v->name.data = ngx_palloc(cf->pool, name->len); + v->name.data = ngx_pnalloc(cf->pool, name->len); if (v->name.data == NULL) { return NULL; } @@ -339,7 +339,7 @@ } v->name.len = name->len; - v->name.data = ngx_palloc(cf->pool, name->len); + v->name.data = ngx_pnalloc(cf->pool, name->len); if (v->name.data == NULL) { return NGX_ERROR; } @@ -615,7 +615,7 @@ len += h[i]->value.len + sizeof("; ") - 1; } - p = ngx_palloc(r->pool, len); + p = ngx_pnalloc(r->pool, len); if (p == NULL) { return NGX_ERROR; } @@ -782,7 +782,7 @@ v->no_cacheable = 0; v->not_found = 0; - v->data = ngx_palloc(r->pool, sizeof("65535") - 1); + v->data = ngx_pnalloc(r->pool, sizeof("65535") - 1); if (v->data == NULL) { return NGX_ERROR; } @@ -809,7 +809,7 @@ { ngx_str_t s; - s.data = ngx_palloc(r->pool, INET_ADDRSTRLEN); + s.data = ngx_pnalloc(r->pool, INET_ADDRSTRLEN); if (s.data == NULL) { return NGX_ERROR; } @@ -1032,7 +1032,7 @@ sent = 0; } - p = ngx_palloc(r->pool, NGX_OFF_T_LEN); + p = ngx_pnalloc(r->pool, NGX_OFF_T_LEN); if (p == NULL) { return NGX_ERROR; } @@ -1083,7 +1083,7 @@ } if (r->headers_out.content_length_n >= 0) { - p = ngx_palloc(r->pool, NGX_OFF_T_LEN); + p = ngx_pnalloc(r->pool, NGX_OFF_T_LEN); if (p == NULL) { return NGX_ERROR; } @@ -1120,7 +1120,7 @@ } if (r->headers_out.last_modified_time >= 0) { - p = ngx_palloc(r->pool, + p = ngx_pnalloc(r->pool, sizeof("Last-Modified: Mon, 28 Sep 1970 06:00:00 GMT") - 1); if (p == NULL) { return NGX_ERROR; @@ -1179,7 +1179,7 @@ if (clcf->keepalive_header) { - p = ngx_palloc(r->pool, sizeof("timeout=") - 1 + NGX_TIME_T_LEN); + p = ngx_pnalloc(r->pool, sizeof("timeout=") - 1 + NGX_TIME_T_LEN); if (p == NULL) { return NGX_ERROR; } diff -r 824615f3b4ec -r 2a92804f4109 src/mail/ngx_mail.c --- a/src/mail/ngx_mail.c Mon Jun 16 09:11:12 2008 +0000 +++ b/src/mail/ngx_mail.c Tue Jun 17 15:00:30 2008 +0000 @@ -357,8 +357,8 @@ imip->addrs[i].addr = in_addr[i].addr; imip->addrs[i].ctx = in_addr[i].ctx; - text = ngx_palloc(cf->pool, - INET_ADDRSTRLEN - 1 + sizeof(":65535") - 1); + text = ngx_pnalloc(cf->pool, + INET_ADDRSTRLEN - 1 + sizeof(":65535") - 1); if (text == NULL) { return NGX_CONF_ERROR; } diff -r 824615f3b4ec -r 2a92804f4109 src/mail/ngx_mail_auth_http_module.c --- a/src/mail/ngx_mail_auth_http_module.c Mon Jun 16 09:11:12 2008 +0000 +++ b/src/mail/ngx_mail_auth_http_module.c Tue Jun 17 15:00:30 2008 +0000 @@ -593,7 +593,7 @@ { s->login.len = ctx->header_end - ctx->header_start; - s->login.data = ngx_palloc(s->connection->pool, s->login.len); + s->login.data = ngx_pnalloc(s->connection->pool, s->login.len); if (s->login.data == NULL) { ngx_close_connection(ctx->peer.connection); ngx_destroy_pool(ctx->pool); @@ -614,7 +614,8 @@ { s->passwd.len = ctx->header_end - ctx->header_start; - s->passwd.data = ngx_palloc(s->connection->pool, s->passwd.len); + s->passwd.data = ngx_pnalloc(s->connection->pool, + s->passwd.len); if (s->passwd.data == NULL) { ngx_close_connection(ctx->peer.connection); ngx_destroy_pool(ctx->pool); @@ -651,8 +652,8 @@ { ctx->errcode.len = ctx->header_end - ctx->header_start; - ctx->errcode.data = ngx_palloc(s->connection->pool, - ctx->errcode.len); + ctx->errcode.data = ngx_pnalloc(s->connection->pool, + ctx->errcode.len); if (ctx->errcode.data == NULL) { ngx_close_connection(ctx->peer.connection); ngx_destroy_pool(ctx->pool); @@ -691,7 +692,7 @@ ctx->err.len = ctx->errcode.len + ctx->errmsg.len + sizeof(" " CRLF) - 1; - p = ngx_palloc(s->connection->pool, ctx->err.len); + p = ngx_pnalloc(s->connection->pool, ctx->err.len); if (p == NULL) { ngx_close_connection(ctx->peer.connection); ngx_destroy_pool(ctx->pool); @@ -810,7 +811,7 @@ peer->name.len = len; - peer->name.data = ngx_palloc(s->connection->pool, len); + peer->name.data = ngx_pnalloc(s->connection->pool, len); if (peer->name.data == NULL) { ngx_destroy_pool(ctx->pool); ngx_mail_session_internal_server_error(s); @@ -1255,7 +1256,7 @@ escaped->len = text->len + n * 2; - p = ngx_palloc(pool, escaped->len); + p = ngx_pnalloc(pool, escaped->len); if (p == NULL) { return NGX_ERROR; } @@ -1326,7 +1327,7 @@ len += header[i].key.len + 2 + header[i].value.len + 2; } - p = ngx_palloc(cf->pool, len); + p = ngx_pnalloc(cf->pool, len); if (p == NULL) { return NGX_CONF_ERROR; } diff -r 824615f3b4ec -r 2a92804f4109 src/mail/ngx_mail_handler.c --- a/src/mail/ngx_mail_handler.c Mon Jun 16 09:11:12 2008 +0000 +++ b/src/mail/ngx_mail_handler.c Tue Jun 17 15:00:30 2008 +0000 @@ -236,10 +236,10 @@ ngx_mail_salt(ngx_mail_session_t *s, ngx_connection_t *c, ngx_mail_core_srv_conf_t *cscf) { - s->salt.data = ngx_palloc(c->pool, - sizeof(" <18446744073709551616.@>" CRLF) - 1 - + NGX_TIME_T_LEN - + cscf->server_name.len); + s->salt.data = ngx_pnalloc(c->pool, + sizeof(" <18446744073709551616.@>" CRLF) - 1 + + NGX_TIME_T_LEN + + cscf->server_name.len); if (s->salt.data == NULL) { return NGX_ERROR; } @@ -288,7 +288,7 @@ "mail auth plain: \"%V\"", &arg[n]); #endif - plain.data = ngx_palloc(c->pool, ngx_base64_decoded_length(arg[n].len)); + plain.data = ngx_pnalloc(c->pool, ngx_base64_decoded_length(arg[n].len)); if (plain.data == NULL){ return NGX_ERROR; } @@ -344,7 +344,7 @@ ngx_log_debug1(NGX_LOG_DEBUG_MAIL, c->log, 0, "mail auth login username: \"%V\"", &arg[0]); - s->login.data = ngx_palloc(c->pool, ngx_base64_decoded_length(arg[0].len)); + s->login.data = ngx_pnalloc(c->pool, ngx_base64_decoded_length(arg[0].len)); if (s->login.data == NULL){ return NGX_ERROR; } @@ -374,7 +374,8 @@ "mail auth login password: \"%V\"", &arg[0]); #endif - s->passwd.data = ngx_palloc(c->pool, ngx_base64_decoded_length(arg[0].len)); + s->passwd.data = ngx_pnalloc(c->pool, + ngx_base64_decoded_length(arg[0].len)); if (s->passwd.data == NULL){ return NGX_ERROR; } @@ -402,7 +403,7 @@ ngx_str_t salt; ngx_uint_t n; - p = ngx_palloc(c->pool, len + ngx_base64_encoded_length(s->salt.len) + 2); + p = ngx_pnalloc(c->pool, len + ngx_base64_encoded_length(s->salt.len) + 2); if (p == NULL) { return NGX_ERROR; } @@ -434,7 +435,7 @@ ngx_log_debug1(NGX_LOG_DEBUG_MAIL, c->log, 0, "mail auth cram-md5: \"%V\"", &arg[0]); - s->login.data = ngx_palloc(c->pool, ngx_base64_decoded_length(arg[0].len)); + s->login.data = ngx_pnalloc(c->pool, ngx_base64_decoded_length(arg[0].len)); if (s->login.data == NULL){ return NGX_ERROR; } diff -r 824615f3b4ec -r 2a92804f4109 src/mail/ngx_mail_imap_handler.c --- a/src/mail/ngx_mail_imap_handler.c Mon Jun 16 09:11:12 2008 +0000 +++ b/src/mail/ngx_mail_imap_handler.c Tue Jun 17 15:00:30 2008 +0000 @@ -259,7 +259,7 @@ if (s->tagged_line.len < s->tag.len + s->text.len + s->out.len) { s->tagged_line.len = s->tag.len + s->text.len + s->out.len; - s->tagged_line.data = ngx_palloc(c->pool, s->tagged_line.len); + s->tagged_line.data = ngx_pnalloc(c->pool, s->tagged_line.len); if (s->tagged_line.data == NULL) { ngx_mail_close_connection(c); return; @@ -317,7 +317,7 @@ } s->login.len = arg[0].len; - s->login.data = ngx_palloc(c->pool, s->login.len); + s->login.data = ngx_pnalloc(c->pool, s->login.len); if (s->login.data == NULL) { return NGX_ERROR; } @@ -325,7 +325,7 @@ ngx_memcpy(s->login.data, arg[0].data, s->login.len); s->passwd.len = arg[1].len; - s->passwd.data = ngx_palloc(c->pool, s->passwd.len); + s->passwd.data = ngx_pnalloc(c->pool, s->passwd.len); if (s->passwd.data == NULL) { return NGX_ERROR; } diff -r 824615f3b4ec -r 2a92804f4109 src/mail/ngx_mail_imap_module.c --- a/src/mail/ngx_mail_imap_module.c Mon Jun 16 09:11:12 2008 +0000 +++ b/src/mail/ngx_mail_imap_module.c Tue Jun 17 15:00:30 2008 +0000 @@ -183,7 +183,7 @@ } } - p = ngx_palloc(cf->pool, size); + p = ngx_pnalloc(cf->pool, size); if (p == NULL) { return NGX_CONF_ERROR; } @@ -216,7 +216,7 @@ size += sizeof(" STARTTLS") - 1; - p = ngx_palloc(cf->pool, size); + p = ngx_pnalloc(cf->pool, size); if (p == NULL) { return NGX_CONF_ERROR; } @@ -233,7 +233,7 @@ size = (auth - conf->capability.data) + sizeof(CRLF) - 1 + sizeof(" STARTTLS LOGINDISABLED") - 1; - p = ngx_palloc(cf->pool, size); + p = ngx_pnalloc(cf->pool, size); if (p == NULL) { return NGX_CONF_ERROR; } diff -r 824615f3b4ec -r 2a92804f4109 src/mail/ngx_mail_pop3_handler.c --- a/src/mail/ngx_mail_pop3_handler.c Mon Jun 16 09:11:12 2008 +0000 +++ b/src/mail/ngx_mail_pop3_handler.c Tue Jun 17 15:00:30 2008 +0000 @@ -46,7 +46,7 @@ return; } - s->out.data = ngx_palloc(c->pool, sizeof(pop3_greeting) + s->salt.len); + s->out.data = ngx_pnalloc(c->pool, sizeof(pop3_greeting) + s->salt.len); if (s->out.data == NULL) { ngx_mail_session_internal_server_error(s); return; @@ -297,7 +297,7 @@ arg = s->args.elts; s->login.len = arg[0].len; - s->login.data = ngx_palloc(c->pool, s->login.len); + s->login.data = ngx_pnalloc(c->pool, s->login.len); if (s->login.data == NULL) { return NGX_ERROR; } @@ -324,7 +324,7 @@ arg = s->args.elts; s->passwd.len = arg[0].len; - s->passwd.data = ngx_palloc(c->pool, s->passwd.len); + s->passwd.data = ngx_pnalloc(c->pool, s->passwd.len); if (s->passwd.data == NULL) { return NGX_ERROR; } @@ -417,7 +417,7 @@ arg = s->args.elts; s->login.len = arg[0].len; - s->login.data = ngx_palloc(c->pool, s->login.len); + s->login.data = ngx_pnalloc(c->pool, s->login.len); if (s->login.data == NULL) { return NGX_ERROR; } @@ -425,7 +425,7 @@ ngx_memcpy(s->login.data, arg[0].data, s->login.len); s->passwd.len = arg[1].len; - s->passwd.data = ngx_palloc(c->pool, s->passwd.len); + s->passwd.data = ngx_pnalloc(c->pool, s->passwd.len); if (s->passwd.data == NULL) { return NGX_ERROR; } diff -r 824615f3b4ec -r 2a92804f4109 src/mail/ngx_mail_pop3_module.c --- a/src/mail/ngx_mail_pop3_module.c Mon Jun 16 09:11:12 2008 +0000 +++ b/src/mail/ngx_mail_pop3_module.c Tue Jun 17 15:00:30 2008 +0000 @@ -183,7 +183,7 @@ size += sizeof("SASL LOGIN PLAIN" CRLF) - 1; } - p = ngx_palloc(cf->pool, size); + p = ngx_pnalloc(cf->pool, size); if (p == NULL) { return NGX_CONF_ERROR; } @@ -213,7 +213,7 @@ size += sizeof("STLS" CRLF) - 1; - p = ngx_palloc(cf->pool, size); + p = ngx_pnalloc(cf->pool, size); if (p == NULL) { return NGX_CONF_ERROR; } @@ -236,7 +236,7 @@ } - p = ngx_palloc(cf->pool, stls_only_size); + p = ngx_pnalloc(cf->pool, stls_only_size); if (p == NULL) { return NGX_CONF_ERROR; } diff -r 824615f3b4ec -r 2a92804f4109 src/mail/ngx_mail_proxy_module.c --- a/src/mail/ngx_mail_proxy_module.c Mon Jun 16 09:11:12 2008 +0000 +++ b/src/mail/ngx_mail_proxy_module.c Tue Jun 17 15:00:30 2008 +0000 @@ -253,7 +253,7 @@ s->connection->log->action = "sending user name to upstream"; line.len = sizeof("USER ") - 1 + s->login.len + 2; - line.data = ngx_palloc(c->pool, line.len); + line.data = ngx_pnalloc(c->pool, line.len); if (line.data == NULL) { ngx_mail_proxy_internal_server_error(s); return; @@ -272,7 +272,7 @@ s->connection->log->action = "sending password to upstream"; line.len = sizeof("PASS ") - 1 + s->passwd.len + 2; - line.data = ngx_palloc(c->pool, line.len); + line.data = ngx_pnalloc(c->pool, line.len); if (line.data == NULL) { ngx_mail_proxy_internal_server_error(s); return; @@ -369,7 +369,7 @@ line.len = s->tag.len + sizeof("LOGIN ") - 1 + 1 + NGX_SIZE_T_LEN + 1 + 2; - line.data = ngx_palloc(c->pool, line.len); + line.data = ngx_pnalloc(c->pool, line.len); if (line.data == NULL) { ngx_mail_proxy_internal_server_error(s); return; @@ -388,7 +388,7 @@ s->connection->log->action = "sending user name to upstream"; line.len = s->login.len + 1 + 1 + NGX_SIZE_T_LEN + 1 + 2; - line.data = ngx_palloc(c->pool, line.len); + line.data = ngx_pnalloc(c->pool, line.len); if (line.data == NULL) { ngx_mail_proxy_internal_server_error(s); return; @@ -408,7 +408,7 @@ s->connection->log->action = "sending password to upstream"; line.len = s->passwd.len + 2; - line.data = ngx_palloc(c->pool, line.len); + line.data = ngx_pnalloc(c->pool, line.len); if (line.data == NULL) { ngx_mail_proxy_internal_server_error(s); return; @@ -505,7 +505,7 @@ cscf = ngx_mail_get_module_srv_conf(s, ngx_mail_core_module); line.len = sizeof("HELO ") - 1 + cscf->server_name.len + 2; - line.data = ngx_palloc(c->pool, line.len); + line.data = ngx_pnalloc(c->pool, line.len); if (line.data == NULL) { ngx_mail_proxy_internal_server_error(s); return; @@ -535,7 +535,7 @@ + s->esmtp + s->smtp_helo.len + s->connection->addr_text.len + s->login.len + s->host.len; - line.data = ngx_palloc(c->pool, line.len); + line.data = ngx_pnalloc(c->pool, line.len); if (line.data == NULL) { ngx_mail_proxy_internal_server_error(s); return; diff -r 824615f3b4ec -r 2a92804f4109 src/mail/ngx_mail_smtp_handler.c --- a/src/mail/ngx_mail_smtp_handler.c Mon Jun 16 09:11:12 2008 +0000 +++ b/src/mail/ngx_mail_smtp_handler.c Tue Jun 17 15:00:30 2008 +0000 @@ -506,7 +506,7 @@ s->smtp_helo.len = arg[0].len; - s->smtp_helo.data = ngx_palloc(c->pool, arg[0].len); + s->smtp_helo.data = ngx_pnalloc(c->pool, arg[0].len); if (s->smtp_helo.data == NULL) { return NGX_ERROR; } diff -r 824615f3b4ec -r 2a92804f4109 src/mail/ngx_mail_smtp_module.c --- a/src/mail/ngx_mail_smtp_module.c Mon Jun 16 09:11:12 2008 +0000 +++ b/src/mail/ngx_mail_smtp_module.c Tue Jun 17 15:00:30 2008 +0000 @@ -160,7 +160,7 @@ size = sizeof("220 ESMTP ready" CRLF) - 1 + cscf->server_name.len; - p = ngx_palloc(cf->pool, size); + p = ngx_pnalloc(cf->pool, size); if (p == NULL) { return NGX_CONF_ERROR; } @@ -175,7 +175,7 @@ size = sizeof("250 " CRLF) - 1 + cscf->server_name.len; - p = ngx_palloc(cf->pool, size); + p = ngx_pnalloc(cf->pool, size); if (p == NULL) { return NGX_CONF_ERROR; } @@ -209,7 +209,7 @@ } } - p = ngx_palloc(cf->pool, size); + p = ngx_pnalloc(cf->pool, size); if (p == NULL) { return NGX_CONF_ERROR; } @@ -247,7 +247,7 @@ size += sizeof("250 STARTTLS" CRLF) - 1; - p = ngx_palloc(cf->pool, size); + p = ngx_pnalloc(cf->pool, size); if (p == NULL) { return NGX_CONF_ERROR; } @@ -268,7 +268,7 @@ size = (auth - conf->capability.data) + sizeof("250 STARTTLS" CRLF) - 1; - p = ngx_palloc(cf->pool, size); + p = ngx_pnalloc(cf->pool, size); if (p == NULL) { return NGX_CONF_ERROR; } diff -r 824615f3b4ec -r 2a92804f4109 src/mysql/ngx_http_mysql_test.c --- a/src/mysql/ngx_http_mysql_test.c Mon Jun 16 09:11:12 2008 +0000 +++ b/src/mysql/ngx_http_mysql_test.c Tue Jun 17 15:00:30 2008 +0000 @@ -129,7 +129,7 @@ m->query.len = NGX_MYSQL_CMDPKT_LEN + ngx_mysql_command_query.len; - m->query.data = ngx_palloc(r->pool, m->query.len); + m->query.data = ngx_pnalloc(r->pool, m->query.len); if (m->query.data == NULL) { ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR); return; diff -r 824615f3b4ec -r 2a92804f4109 src/mysql/ngx_mysql.c --- a/src/mysql/ngx_mysql.c Mon Jun 16 09:11:12 2008 +0000 +++ b/src/mysql/ngx_mysql.c Tue Jun 17 15:00:30 2008 +0000 @@ -215,7 +215,7 @@ len += 20; } - auth = ngx_palloc(m->pool, len); + auth = ngx_pnalloc(m->pool, len); if (auth == NULL) { ngx_mysql_close(m, NGX_ERROR); return; diff -r 824615f3b4ec -r 2a92804f4109 src/os/unix/ngx_process_cycle.c --- a/src/os/unix/ngx_process_cycle.c Mon Jun 16 09:11:12 2008 +0000 +++ b/src/os/unix/ngx_process_cycle.c Tue Jun 17 15:00:30 2008 +0000 @@ -108,7 +108,7 @@ size += ngx_strlen(ngx_argv[i]) + 1; } - title = ngx_palloc(cycle->pool, size); + title = ngx_pnalloc(cycle->pool, size); p = ngx_cpymem(title, master_process, sizeof(master_process) - 1); for (i = 0; i < ngx_argc; i++) { diff -r 824615f3b4ec -r 2a92804f4109 src/os/unix/ngx_user.c --- a/src/os/unix/ngx_user.c Mon Jun 16 09:11:12 2008 +0000 +++ b/src/os/unix/ngx_user.c Tue Jun 17 15:00:30 2008 +0000 @@ -43,7 +43,7 @@ if (err == 0) { len = ngx_strlen(value); - *encrypted = ngx_palloc(pool, len); + *encrypted = ngx_pnalloc(pool, len); if (*encrypted) { ngx_memcpy(*encrypted, value, len + 1); return NGX_OK; @@ -81,7 +81,7 @@ if (value) { len = ngx_strlen(value); - *encrypted = ngx_palloc(pool, len); + *encrypted = ngx_pnalloc(pool, len); if (*encrypted) { ngx_memcpy(*encrypted, value, len + 1); }