Mercurial > hg > nginx
comparison src/core/ngx_list.c @ 766:791ea37bc944
ngx_list_create()
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Wed, 11 Oct 2006 12:47:11 +0000 |
parents | d4ea69372b94 |
children | d620f497c50f |
comparison
equal
deleted
inserted
replaced
765:4cb8f85c085d | 766:791ea37bc944 |
---|---|
6 | 6 |
7 #include <ngx_config.h> | 7 #include <ngx_config.h> |
8 #include <ngx_core.h> | 8 #include <ngx_core.h> |
9 | 9 |
10 | 10 |
11 void *ngx_list_push(ngx_list_t *l) | 11 ngx_list_t * |
12 ngx_list_create(ngx_pool_t *pool, ngx_uint_t n, size_t size) | |
13 { | |
14 ngx_list_t *list; | |
15 | |
16 list = ngx_palloc(pool, sizeof(ngx_list_t)); | |
17 if (list == NULL) { | |
18 return NULL; | |
19 } | |
20 | |
21 list->part.elts = ngx_palloc(pool, n * size); | |
22 if (list->part.elts == NULL) { | |
23 return NULL; | |
24 } | |
25 | |
26 list->part.nelts = 0; | |
27 list->part.next = NULL; | |
28 list->last = &list->part; | |
29 list->size = size; | |
30 list->nalloc = n; | |
31 list->pool = pool; | |
32 | |
33 return list; | |
34 } | |
35 | |
36 | |
37 void * | |
38 ngx_list_push(ngx_list_t *l) | |
12 { | 39 { |
13 void *elt; | 40 void *elt; |
14 ngx_list_part_t *last; | 41 ngx_list_part_t *last; |
15 | 42 |
16 last = l->last; | 43 last = l->last; |