Sha256: e672585fd9cea13e31eeb7e781a0483a94f7bcb7a7a8c2d6914ec4b581dea623

Contents?: true

Size: 1.04 KB

Versions: 16

Compression:

Stored size: 1.04 KB

Contents

/*
 * Copyright (C) Igor Sysoev
 * Copyright (C) Nginx, Inc.
 */


#ifndef _NGX_ARRAY_H_INCLUDED_
#define _NGX_ARRAY_H_INCLUDED_


#include <ngx_config.h>
#include <ngx_core.h>


struct ngx_array_s {
    void        *elts;
    ngx_uint_t   nelts;
    size_t       size;
    ngx_uint_t   nalloc;
    ngx_pool_t  *pool;
};


ngx_array_t *ngx_array_create(ngx_pool_t *p, ngx_uint_t n, size_t size);
void ngx_array_destroy(ngx_array_t *a);
void *ngx_array_push(ngx_array_t *a);
void *ngx_array_push_n(ngx_array_t *a, ngx_uint_t n);


static ngx_inline ngx_int_t
ngx_array_init(ngx_array_t *array, ngx_pool_t *pool, ngx_uint_t n, size_t size)
{
    /*
     * set "array->nelts" before "array->elts", otherwise MSVC thinks
     * that "array->nelts" may be used without having been initialized
     */

    array->nelts = 0;
    array->size = size;
    array->nalloc = n;
    array->pool = pool;

    array->elts = ngx_palloc(pool, n * size);
    if (array->elts == NULL) {
        return NGX_ERROR;
    }

    return NGX_OK;
}


#endif /* _NGX_ARRAY_H_INCLUDED_ */

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
nginxtra-1.2.8.8 vendor/nginx/src/core/ngx_array.h
nginxtra-1.2.7.8 vendor/nginx/src/core/ngx_array.h
nginxtra-1.2.6.8 vendor/nginx/src/core/ngx_array.h
nginxtra-1.2.6.7 vendor/nginx/src/core/ngx_array.h
nginxtra-1.2.5.7 vendor/nginx/src/core/ngx_array.h
nginxtra-1.2.4.7 vendor/nginx/src/core/ngx_array.h
nginxtra-1.2.3.7 vendor/nginx/src/core/ngx_array.h
nginxtra-1.2.3.6 vendor/nginx/src/core/ngx_array.h
nginxtra-1.2.3.5 vendor/nginx/src/core/ngx_array.h
nginxtra-1.2.3.4 vendor/nginx/src/core/ngx_array.h
nginxtra-1.2.2.4 vendor/nginx/src/core/ngx_array.h
nginxtra-1.2.2.3 src/nginx/src/core/ngx_array.h
nginxtra-1.2.1.3 src/nginx/src/core/ngx_array.h
nginxtra-1.2.1.2 src/nginx/src/core/ngx_array.h
nginxtra-1.2.0.1 src/nginx/src/core/ngx_array.h
nginxtra-1.0.15.0 src/nginx/src/core/ngx_array.h