blob: f54517fd58b3d41e1d5f28340e1cd272b7d04702 [file] [log] [blame]
Igor Sysoev6de5c2c2002-08-06 16:39:45 +00001#ifndef _NGX_ARRAY_H_INCLUDED_
2#define _NGX_ARRAY_H_INCLUDED_
3
4
5#include <ngx_config.h>
Igor Sysoev1c104622003-06-03 15:42:58 +00006#include <ngx_core.h>
Igor Sysoev6de5c2c2002-08-06 16:39:45 +00007
Igor Sysoev6de5c2c2002-08-06 16:39:45 +00008
Igor Sysoev5f800782003-12-08 20:48:12 +00009struct ngx_array_s {
Igor Sysoev10a543a2004-03-16 07:10:12 +000010 void *elts;
11 ngx_uint_t nelts;
12 size_t size;
13 ngx_uint_t nalloc;
14 ngx_pool_t *pool;
Igor Sysoev5f800782003-12-08 20:48:12 +000015};
Igor Sysoev6de5c2c2002-08-06 16:39:45 +000016
17
Igor Sysoev10a543a2004-03-16 07:10:12 +000018ngx_array_t *ngx_create_array(ngx_pool_t *p, ngx_uint_t n, size_t size);
Igor Sysoev6de5c2c2002-08-06 16:39:45 +000019void ngx_destroy_array(ngx_array_t *a);
20void *ngx_push_array(ngx_array_t *a);
21
22
Igor Sysoev4e9393a2003-01-09 05:36:00 +000023#define ngx_init_array(a, p, n, s, rc) \
24 ngx_test_null(a.elts, ngx_palloc(p, n * s), rc); \
25 a.nelts = 0; a.size = s; a.nalloc = n; a.pool = p;
26
27
Igor Sysoev6de5c2c2002-08-06 16:39:45 +000028#endif /* _NGX_ARRAY_H_INCLUDED_ */