comparison src/core/ngx_palloc.c @ 138:8e6d4d96ec4c NGINX_0_3_16

nginx 0.3.16 *) Feature: the ngx_http_map_module. *) Feature: the "types_hash_max_size" and "types_hash_bucket_size" directives. *) Feature: the "ssi_value_length" directive. *) Feature: the "worker_rlimit_core" directive. *) Workaround: the connection number in logs was always 1 if nginx was built by the icc 8.1 or 9.0 compilers with optimization for Pentium 4. *) Bugfix: the "config timefmt" SSI command set incorrect time format. *) Bugfix: nginx did not close connection to IMAP/POP3 backend for the SSL connections; bug appeared in 0.3.13. Thanks to Rob Mueller. *) Bugfix: segmentation fault may occurred in at SSL shutdown; bug appeared in 0.3.13.
author Igor Sysoev <http://sysoev.ru>
date Fri, 16 Dec 2005 00:00:00 +0300
parents 91372f004adf
children bb61aa162c6b
comparison
equal deleted inserted replaced
137:768f51dd150b 138:8e6d4d96ec4c
88 ngx_pool_t *p, *n; 88 ngx_pool_t *p, *n;
89 ngx_pool_large_t *large, *last; 89 ngx_pool_large_t *large, *last;
90 90
91 if (size <= (size_t) NGX_MAX_ALLOC_FROM_POOL 91 if (size <= (size_t) NGX_MAX_ALLOC_FROM_POOL
92 && size <= (size_t) (pool->end - (u_char *) pool) 92 && size <= (size_t) (pool->end - (u_char *) pool)
93 - (size_t) ngx_align(sizeof(ngx_pool_t))) 93 - (size_t) ngx_align_ptr(sizeof(ngx_pool_t), NGX_ALIGNMENT))
94 { 94 {
95 for (p = pool->current; /* void */ ; p = p->next) { 95 for (p = pool->current; /* void */ ; p = p->next) {
96 m = ngx_align(p->last); 96
97 if (size < sizeof(int) || (size & 1)) {
98 m = p->last;
99
100 } else {
101 m = ngx_align_ptr(p->last, NGX_ALIGNMENT);
102 }
97 103
98 if ((size_t) (p->end - m) >= size) { 104 if ((size_t) (p->end - m) >= size) {
99 p->last = m + size; 105 p->last = m + size;
100 106
101 return m; 107 return m;
120 if (pool->current == NULL) { 126 if (pool->current == NULL) {
121 pool->current = n; 127 pool->current = n;
122 } 128 }
123 129
124 p->next = n; 130 p->next = n;
125 m = ngx_align(n->last); 131 m = ngx_align_ptr(n->last, NGX_ALIGNMENT);
126 n->last = m + size; 132 n->last = m + size;
127 133
128 return m; 134 return m;
129 } 135 }
130 136