mirror of
https://github.com/neovim/neovim.git
synced 2025-09-30 06:58:35 +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
@@ -197,10 +197,7 @@ void ga_concat(garray_T *gap, const char_u *restrict s)
|
||||
/// @param c
|
||||
void ga_append(garray_T *gap, char c)
|
||||
{
|
||||
ga_grow(gap, 1);
|
||||
char *str = gap->ga_data;
|
||||
str[gap->ga_len] = c;
|
||||
gap->ga_len++;
|
||||
GA_APPEND(char, gap, c);
|
||||
}
|
||||
|
||||
#if defined(UNIX) || defined(WIN3264) || defined(PROTO)
|
||||
|
Reference in New Issue
Block a user