1 2/* 3 * Copyright (C) Igor Sysoev 4 * Copyright (C) NGINX, Inc. 5 */ 6 7#ifndef _NXT_VECTOR_H_INCLUDED_ 8#define _NXT_VECTOR_H_INCLUDED_ 9 10 11typedef enum { 12 NXT_VECTOR_INITED = 0, 13 NXT_VECTOR_DESCRETE, 14 NXT_VECTOR_EMBEDDED, 15} nxt_vector_type_t; 16 17 18typedef struct { 19 void *start; 20 /* 21 * A vector can hold no more than 65536 items. 22 * The item size is no more than 64K. 23 */ 24 uint16_t items; 25 uint16_t avalaible; 26 uint16_t item_size; 27 nxt_vector_type_t type:8; 28} nxt_vector_t; 29 30 31NXT_EXPORT nxt_vector_t *nxt_vector_create(nxt_uint_t items, size_t item_size, 32 const nxt_mem_proto_t *proto, void *pool); 33NXT_EXPORT void *nxt_vector_init(nxt_vector_t *vector, nxt_uint_t items, 34 size_t item_size, const nxt_mem_proto_t *proto, void *pool); 35NXT_EXPORT void nxt_vector_destroy(nxt_vector_t *vector, 36 const nxt_mem_proto_t *proto, void *pool); 37NXT_EXPORT void *nxt_vector_add(nxt_vector_t *vector, 38 const nxt_mem_proto_t *proto, void *pool); 39NXT_EXPORT void *nxt_vector_zero_add(nxt_vector_t *vector, 40 const nxt_mem_proto_t *proto, void *pool); 41NXT_EXPORT void nxt_vector_remove(nxt_vector_t *vector, void *item); 42 43 44#define \ 45nxt_vector_last(vector) \
| 1 2/* 3 * Copyright (C) Igor Sysoev 4 * Copyright (C) NGINX, Inc. 5 */ 6 7#ifndef _NXT_VECTOR_H_INCLUDED_ 8#define _NXT_VECTOR_H_INCLUDED_ 9 10 11typedef enum { 12 NXT_VECTOR_INITED = 0, 13 NXT_VECTOR_DESCRETE, 14 NXT_VECTOR_EMBEDDED, 15} nxt_vector_type_t; 16 17 18typedef struct { 19 void *start; 20 /* 21 * A vector can hold no more than 65536 items. 22 * The item size is no more than 64K. 23 */ 24 uint16_t items; 25 uint16_t avalaible; 26 uint16_t item_size; 27 nxt_vector_type_t type:8; 28} nxt_vector_t; 29 30 31NXT_EXPORT nxt_vector_t *nxt_vector_create(nxt_uint_t items, size_t item_size, 32 const nxt_mem_proto_t *proto, void *pool); 33NXT_EXPORT void *nxt_vector_init(nxt_vector_t *vector, nxt_uint_t items, 34 size_t item_size, const nxt_mem_proto_t *proto, void *pool); 35NXT_EXPORT void nxt_vector_destroy(nxt_vector_t *vector, 36 const nxt_mem_proto_t *proto, void *pool); 37NXT_EXPORT void *nxt_vector_add(nxt_vector_t *vector, 38 const nxt_mem_proto_t *proto, void *pool); 39NXT_EXPORT void *nxt_vector_zero_add(nxt_vector_t *vector, 40 const nxt_mem_proto_t *proto, void *pool); 41NXT_EXPORT void nxt_vector_remove(nxt_vector_t *vector, void *item); 42 43 44#define \ 45nxt_vector_last(vector) \
|