nxt_vector.h (98:4077decf847b) nxt_vector.h (2084:7d479274f334)
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_

--- 27 unchanged lines hidden (view full) ---

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
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_

--- 27 unchanged lines hidden (view full) ---

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) \
44#define nxt_vector_last(vector) \
46 nxt_pointer_to((vector)->start, \
47 (vector)->item_size * ((vector)->items - 1))
48
49
45 nxt_pointer_to((vector)->start, \
46 (vector)->item_size * ((vector)->items - 1))
47
48
50#define \
51nxt_vector_reset(vector) \
49#define nxt_vector_reset(vector) \
52 (vector)->items = 0;
53
54
50 (vector)->items = 0;
51
52
55#define \
56nxt_vector_is_empty(vector) \
53#define nxt_vector_is_empty(vector) \
57 ((vector)->items == 0)
58
59
60nxt_inline void *
61nxt_vector_remove_last(nxt_vector_t *vector)
62{
63 vector->items--;
64 return nxt_pointer_to(vector->start, vector->item_size * vector->items);
65}
66
67
68#endif /* _NXT_VECTOR_H_INCLUDED_ */
54 ((vector)->items == 0)
55
56
57nxt_inline void *
58nxt_vector_remove_last(nxt_vector_t *vector)
59{
60 vector->items--;
61 return nxt_pointer_to(vector->start, vector->item_size * vector->items);
62}
63
64
65#endif /* _NXT_VECTOR_H_INCLUDED_ */