Mercurial > hg > nginx-quic
comparison src/core/ngx_palloc.c @ 2056:3ea9a03a1803
fix the previous commit
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Fri, 20 Jun 2008 21:06:53 +0000 |
parents | cca975b532bf |
children | 24eebb21b5d2 |
comparison
equal
deleted
inserted
replaced
2055:cca975b532bf | 2056:3ea9a03a1803 |
---|---|
157 size_t psize; | 157 size_t psize; |
158 ngx_pool_t *p, *new, *current; | 158 ngx_pool_t *p, *new, *current; |
159 | 159 |
160 psize = (size_t) (pool->d.end - (u_char *) pool); | 160 psize = (size_t) (pool->d.end - (u_char *) pool); |
161 | 161 |
162 new = ngx_alloc(size, pool->log); | 162 m = ngx_alloc(psize, pool->log); |
163 if (new == NULL) { | 163 if (m == NULL) { |
164 return NULL; | 164 return NULL; |
165 } | 165 } |
166 | 166 |
167 new->d.end = (u_char *) new + psize; | 167 new = (ngx_pool_t *) m; |
168 | |
169 new->d.end = m + psize; | |
168 new->d.next = NULL; | 170 new->d.next = NULL; |
171 | |
172 m += sizeof(ngx_pool_data_t); | |
173 new->d.last = m + size; | |
169 | 174 |
170 current = pool->current; | 175 current = pool->current; |
171 | 176 |
172 for (p = current; p->d.next; p = p->d.next) { | 177 for (p = current; p->d.next; p = p->d.next) { |
173 if ((size_t) (p->d.end - p->d.last) < NGX_ALIGNMENT) { | 178 if ((size_t) (p->d.end - p->d.last) < NGX_ALIGNMENT) { |
176 } | 181 } |
177 | 182 |
178 p->d.next = new; | 183 p->d.next = new; |
179 | 184 |
180 pool->current = current ? current : new; | 185 pool->current = current ? current : new; |
181 | |
182 m = (u_char *) new + sizeof(ngx_pool_data_t); | |
183 new->d.last = m + size; | |
184 | 186 |
185 return m; | 187 return m; |
186 } | 188 } |
187 | 189 |
188 | 190 |