ngx_reset_pool()

This commit is contained in:
Igor Sysoev 2008-11-25 14:25:20 +00:00
parent ecbb69ad7f
commit 65eba4b692
2 changed files with 21 additions and 0 deletions

View File

@ -91,6 +91,26 @@ ngx_destroy_pool(ngx_pool_t *pool)
}
void
ngx_reset_pool(ngx_pool_t *pool)
{
ngx_pool_t *p;
ngx_pool_large_t *l;
for (l = pool->large; l; l = l->next) {
if (l->alloc) {
ngx_free(l->alloc);
}
}
pool->large = NULL;
for (p = pool; p; p = p->d.next) {
p->d.last = (u_char *) p + sizeof(ngx_pool_t);
}
}
void *
ngx_palloc(ngx_pool_t *pool, size_t size)
{

View File

@ -73,6 +73,7 @@ void *ngx_calloc(size_t size, ngx_log_t *log);
ngx_pool_t *ngx_create_pool(size_t size, ngx_log_t *log);
void ngx_destroy_pool(ngx_pool_t *pool);
void ngx_reset_pool(ngx_pool_t *pool);
void *ngx_palloc(ngx_pool_t *pool, size_t size);
void *ngx_pnalloc(ngx_pool_t *pool, size_t size);