Mercurial > hg > nginx
comparison src/core/ngx_alloc.c @ 104:7db96f59bc29
nginx-0.0.1-2003-06-12-09:54:39 import
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Thu, 12 Jun 2003 05:54:39 +0000 |
parents | 7ebc8b7fb816 |
children | fcc79370b9a8 |
comparison
equal
deleted
inserted
replaced
103:6dfda4cf5200 | 104:7db96f59bc29 |
---|---|
72 pool = NULL; | 72 pool = NULL; |
73 } | 73 } |
74 | 74 |
75 void *ngx_palloc(ngx_pool_t *pool, size_t size) | 75 void *ngx_palloc(ngx_pool_t *pool, size_t size) |
76 { | 76 { |
77 void *m; | 77 char *m; |
78 ngx_pool_t *p, *n; | 78 ngx_pool_t *p, *n; |
79 ngx_pool_large_t *large, *last; | 79 ngx_pool_large_t *large, *last; |
80 | 80 |
81 if (size <= NGX_MAX_ALLOC_FROM_POOL) { | 81 if (size <= NGX_MAX_ALLOC_FROM_POOL) { |
82 | 82 |
83 for (p = pool, n = pool->next; /* void */; p = n, n = n->next) { | 83 for (p = pool, n = pool->next; /* void */; p = n, n = n->next) { |
84 if ((size_t) (p->end - ngx_align(p->last)) >= size) { | 84 m = ngx_align(p->last); |
85 m = ngx_align(p->last); | 85 |
86 p->last = ngx_align(p->last); | 86 if ((size_t) (p->end - m) >= size) { |
87 p->last += size ; | 87 p->last = m + size ; |
88 | 88 |
89 return m; | 89 return m; |
90 } | 90 } |
91 | 91 |
92 if (n == NULL) { | 92 if (n == NULL) { |