nxt_array.h (65:10688b89aa16) nxt_array.h (98:4077decf847b)
1
2/*
3 * Copyright (C) Igor Sysoev
4 * Copyright (C) NGINX, Inc.
5 */
6
7#ifndef _NXT_ARRAY_H_INCLUDED_
8#define _NXT_ARRAY_H_INCLUDED_

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

22 size_t size);
23NXT_EXPORT void *nxt_array_add(nxt_array_t *array);
24NXT_EXPORT void *nxt_array_zero_add(nxt_array_t *array);
25NXT_EXPORT void nxt_array_remove(nxt_array_t *array, void *elt);
26
27
28#define \
29nxt_array_last(array) \
1
2/*
3 * Copyright (C) Igor Sysoev
4 * Copyright (C) NGINX, Inc.
5 */
6
7#ifndef _NXT_ARRAY_H_INCLUDED_
8#define _NXT_ARRAY_H_INCLUDED_

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

22 size_t size);
23NXT_EXPORT void *nxt_array_add(nxt_array_t *array);
24NXT_EXPORT void *nxt_array_zero_add(nxt_array_t *array);
25NXT_EXPORT void nxt_array_remove(nxt_array_t *array, void *elt);
26
27
28#define \
29nxt_array_last(array) \
30 ((void *) ((char *) (array)->elts + (array)->size * ((array)->nelts - 1)))
30 nxt_pointer_to((array)->elts, (array)->size * ((array)->nelts - 1))
31
32
33#define \
34nxt_array_reset(array) \
35 (array)->nelts = 0;
36
37
38#define \
39nxt_array_is_empty(array) \
40 ((array)->nelts == 0)
41
42
43nxt_inline void *
44nxt_array_remove_last(nxt_array_t *array)
45{
46 array->nelts--;
31
32
33#define \
34nxt_array_reset(array) \
35 (array)->nelts = 0;
36
37
38#define \
39nxt_array_is_empty(array) \
40 ((array)->nelts == 0)
41
42
43nxt_inline void *
44nxt_array_remove_last(nxt_array_t *array)
45{
46 array->nelts--;
47 return (char *) array->elts + array->size * array->nelts;
47 return nxt_pointer_to(array->elts, array->size * array->nelts);
48}
49
50
51#endif /* _NXT_ARRAY_H_INCLUDED_ */
48}
49
50
51#endif /* _NXT_ARRAY_H_INCLUDED_ */