Mercurial > hg > nginx
comparison src/core/ngx_array.h @ 415:3c56e834be46
nginx-0.0.10-2004-09-05-23:54:02 import
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Sun, 05 Sep 2004 19:54:02 +0000 |
parents | 87e73f067470 |
children | b9bd635011de |
comparison
equal
deleted
inserted
replaced
414:388a842cbbe1 | 415:3c56e834be46 |
---|---|
18 ngx_array_t *ngx_create_array(ngx_pool_t *p, ngx_uint_t n, size_t size); | 18 ngx_array_t *ngx_create_array(ngx_pool_t *p, ngx_uint_t n, size_t size); |
19 void ngx_destroy_array(ngx_array_t *a); | 19 void ngx_destroy_array(ngx_array_t *a); |
20 void *ngx_push_array(ngx_array_t *a); | 20 void *ngx_push_array(ngx_array_t *a); |
21 | 21 |
22 | 22 |
23 ngx_inline static ngx_int_t ngx_init_array0(ngx_array_t *array, ngx_pool_t *pool, | |
24 ngx_uint_t n, size_t size) | |
25 { | |
26 if (!(array->elts = ngx_palloc(pool, n * size))) { | |
27 return NGX_ERROR; | |
28 } | |
29 | |
30 array->nelts = 0; | |
31 array->size = size; | |
32 array->nalloc = n; | |
33 array->pool = pool; | |
34 | |
35 return NGX_OK; | |
36 } | |
37 | |
38 | |
39 | |
23 #define ngx_init_array(a, p, n, s, rc) \ | 40 #define ngx_init_array(a, p, n, s, rc) \ |
24 ngx_test_null(a.elts, ngx_palloc(p, n * s), rc); \ | 41 ngx_test_null(a.elts, ngx_palloc(p, n * s), rc); \ |
25 a.nelts = 0; a.size = s; a.nalloc = n; a.pool = p; | 42 a.nelts = 0; a.size = s; a.nalloc = n; a.pool = p; |
26 | 43 |
27 | 44 |