3 * Copyright (C) Igor Sysoev
7 #include <ngx_config.h>
12 ngx_list_create(ngx_pool_t *pool, ngx_uint_t n, size_t size)
16 list = ngx_palloc(pool, sizeof(ngx_list_t));
21 list->part.elts = ngx_palloc(pool, n * size);
22 if (list->part.elts == NULL) {
27 list->part.next = NULL;
28 list->last = &list->part;
38 ngx_list_push(ngx_list_t *l)
41 ngx_list_part_t *last;
45 if (last->nelts == l->nalloc) {
47 /* the last part is full, allocate a new list part */
49 last = ngx_palloc(l->pool, sizeof(ngx_list_part_t));
54 last->elts = ngx_palloc(l->pool, l->nalloc * l->size);
55 if (last->elts == NULL) {
66 elt = (char *) last->elts + l->size * last->nelts;