mirror of
https://github.com/neovim/neovim.git
synced 2025-10-03 00:18:33 +00:00
Introduce GA_APPEND()
This macro is used to append an element to a growable array. It replaces this common idiom: ga_grow(&ga, 1); ((item_type *)ga.ga_data)[ga.ga_len] = item; ++ga.ga_len;
This commit is contained in:

committed by
Justin M. Keyes

parent
be3a4b6ca8
commit
45e7814e6a
@@ -16,6 +16,12 @@ typedef struct growarray {
|
||||
|
||||
#define GA_EMPTY(ga_ptr) ((ga_ptr)->ga_len <= 0)
|
||||
|
||||
#define GA_APPEND(item_type, gap, item) \
|
||||
do { \
|
||||
ga_grow(gap, 1); \
|
||||
((item_type *)(gap)->ga_data)[(gap)->ga_len++] = (item); \
|
||||
} while (0)
|
||||
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
# include "garray.h.generated.h"
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user