Mercurial > hg > nginx-quic
comparison src/core/ngx_palloc.c @ 2055:cca975b532bf
small optimization
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Fri, 20 Jun 2008 20:57:40 +0000 |
parents | 2a92804f4109 |
children | 3ea9a03a1803 |
comparison
equal
deleted
inserted
replaced
2054:989176d3ffc5 | 2055:cca975b532bf |
---|---|
152 | 152 |
153 static void * | 153 static void * |
154 ngx_palloc_block(ngx_pool_t *pool, size_t size) | 154 ngx_palloc_block(ngx_pool_t *pool, size_t size) |
155 { | 155 { |
156 u_char *m; | 156 u_char *m; |
157 size_t psize; | |
157 ngx_pool_t *p, *new, *current; | 158 ngx_pool_t *p, *new, *current; |
158 | 159 |
159 new = ngx_create_pool((size_t) (pool->d.end - (u_char *) pool), pool->log); | 160 psize = (size_t) (pool->d.end - (u_char *) pool); |
161 | |
162 new = ngx_alloc(size, pool->log); | |
160 if (new == NULL) { | 163 if (new == NULL) { |
161 return NULL; | 164 return NULL; |
162 } | 165 } |
166 | |
167 new->d.end = (u_char *) new + psize; | |
168 new->d.next = NULL; | |
163 | 169 |
164 current = pool->current; | 170 current = pool->current; |
165 | 171 |
166 for (p = current; p->d.next; p = p->d.next) { | 172 for (p = current; p->d.next; p = p->d.next) { |
167 if ((size_t) (p->d.end - p->d.last) < NGX_ALIGNMENT) { | 173 if ((size_t) (p->d.end - p->d.last) < NGX_ALIGNMENT) { |