Update and clean Tomato RAF files
[tomato.git] / release / src / router / nginx / src / core / ngx_array.h
bloba0f2a744021045ae8ac610bfa106bf414e08f7d1
2 /*
3 * Copyright (C) Igor Sysoev
4 * Copyright (C) Nginx, Inc.
5 */
8 #ifndef _NGX_ARRAY_H_INCLUDED_
9 #define _NGX_ARRAY_H_INCLUDED_
12 #include <ngx_config.h>
13 #include <ngx_core.h>
16 typedef struct {
17 void *elts;
18 ngx_uint_t nelts;
19 size_t size;
20 ngx_uint_t nalloc;
21 ngx_pool_t *pool;
22 } ngx_array_t;
25 ngx_array_t *ngx_array_create(ngx_pool_t *p, ngx_uint_t n, size_t size);
26 void ngx_array_destroy(ngx_array_t *a);
27 void *ngx_array_push(ngx_array_t *a);
28 void *ngx_array_push_n(ngx_array_t *a, ngx_uint_t n);
31 static ngx_inline ngx_int_t
32 ngx_array_init(ngx_array_t *array, ngx_pool_t *pool, ngx_uint_t n, size_t size)
35 * set "array->nelts" before "array->elts", otherwise MSVC thinks
36 * that "array->nelts" may be used without having been initialized
39 array->nelts = 0;
40 array->size = size;
41 array->nalloc = n;
42 array->pool = pool;
44 array->elts = ngx_palloc(pool, n * size);
45 if (array->elts == NULL) {
46 return NGX_ERROR;
49 return NGX_OK;
53 #endif /* _NGX_ARRAY_H_INCLUDED_ */