mirror of
https://github.com/neovim/neovim.git
synced 2025-09-27 21:48:35 +00:00

I've checked all uses of ga_concat in the codebase: - ex_cmds2.c - ex_getln.c - eval.c - message.c - regexp-nfa.c - term.c - spell.c None of them concats the garray with itself. This makes it safe to use the faster memcpy() instead of memmove(). This change was also documented.
32 lines
1.2 KiB
C
32 lines
1.2 KiB
C
#ifndef NEOVIM_GARRAY_H
|
|
#define NEOVIM_GARRAY_H
|
|
|
|
#include "func_attr.h"
|
|
|
|
/// Structure used for growing arrays.
|
|
/// This is used to store information that only grows, is deleted all at
|
|
/// once, and needs to be accessed by index. See ga_clear() and ga_grow().
|
|
typedef struct growarray {
|
|
int ga_len; // current number of items used
|
|
int ga_maxlen; // maximum number of items possible
|
|
int ga_itemsize; // sizeof(item)
|
|
int ga_growsize; // number of items to grow each time
|
|
void *ga_data; // pointer to the first item
|
|
} garray_T;
|
|
|
|
#define GA_EMPTY { 0, 0, 0, 0, NULL }
|
|
|
|
void ga_clear(garray_T *gap);
|
|
void ga_clear_strings(garray_T *gap);
|
|
void ga_init(garray_T *gap, int itemsize, int growsize);
|
|
void ga_grow(garray_T *gap, int n);
|
|
char_u *ga_concat_strings_sep(const garray_T *gap, const char *sep)
|
|
FUNC_ATTR_NONNULL_RET;
|
|
char_u *ga_concat_strings(const garray_T *gap) FUNC_ATTR_NONNULL_RET;
|
|
void ga_remove_duplicate_strings(garray_T *gap);
|
|
void ga_concat(garray_T *gap, const char_u *restrict s);
|
|
void ga_append(garray_T *gap, char c);
|
|
void append_ga_line(garray_T *gap);
|
|
|
|
#endif // NEOVIM_GARRAY_H
|