Mercurial > hg > nginx-quic
comparison src/core/ngx_list.h @ 414:388a842cbbe1
nginx-0.0.10-2004-09-03-19:50:30 import
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Fri, 03 Sep 2004 15:50:30 +0000 |
parents | |
children | 3c56e834be46 |
comparison
equal
deleted
inserted
replaced
413:de9d4726e28a | 414:388a842cbbe1 |
---|---|
1 #ifndef _NGX_LIST_H_INCLUDED_ | |
2 #define _NGX_LIST_H_INCLUDED_ | |
3 | |
4 | |
5 #include <ngx_config.h> | |
6 #include <ngx_core.h> | |
7 | |
8 | |
9 typedef struct ngx_list_part_s ngx_list_part_t; | |
10 | |
11 struct ngx_list_part_s { | |
12 void *elts; | |
13 ngx_uint_t nelts; | |
14 ngx_list_part_t *next; | |
15 }; | |
16 | |
17 | |
18 typedef struct { | |
19 ngx_list_part_t *last; | |
20 ngx_list_part_t part; | |
21 size_t size; | |
22 ngx_uint_t nalloc; | |
23 ngx_pool_t *pool; | |
24 } ngx_list_t; | |
25 | |
26 | |
27 #define ngx_init_list(l, p, n, s, rc) \ | |
28 if (!(l.part.elts = ngx_palloc(p, n * s))) { \ | |
29 return rc; \ | |
30 } \ | |
31 l.part.nelts = 0; l.part.next = NULL; \ | |
32 l.last = &l.part; l.size = s; l.nalloc = n; l.pool = p; | |
33 | |
34 | |
35 #define ngx_iterate_list(p, i) \ | |
36 for ( ;; i++) { \ | |
37 if (i >= p->nelts) { \ | |
38 if (p->next == NULL) { \ | |
39 break; \ | |
40 } \ | |
41 p = p->next; i = 0; \ | |
42 } | |
43 | |
44 | |
45 void *ngx_push_list(ngx_list_t *list); | |
46 | |
47 | |
48 #endif /* _NGX_LIST_H_INCLUDED_ */ |