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

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

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_

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

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