diff options
author | Josh Rahm <joshuarahm@gmail.com> | 2023-11-29 22:39:54 +0000 |
---|---|---|
committer | Josh Rahm <joshuarahm@gmail.com> | 2023-11-29 22:39:54 +0000 |
commit | 21cb7d04c387e4198ca8098a884c78b56ffcf4c2 (patch) | |
tree | 84fe5690df1551f0bb2bdfe1a13aacd29ebc1de7 /src/nvim/garray.h | |
parent | d9c904f85a23a496df4eb6be42aa43f007b22d50 (diff) | |
parent | 4a8bf24ac690004aedf5540fa440e788459e5e34 (diff) | |
download | rneovim-colorcolchar.tar.gz rneovim-colorcolchar.tar.bz2 rneovim-colorcolchar.zip |
Merge remote-tracking branch 'upstream/master' into colorcolcharcolorcolchar
Diffstat (limited to 'src/nvim/garray.h')
-rw-r--r-- | src/nvim/garray.h | 24 |
1 files changed, 4 insertions, 20 deletions
diff --git a/src/nvim/garray.h b/src/nvim/garray.h index 1623c4db7b..a96deda759 100644 --- a/src/nvim/garray.h +++ b/src/nvim/garray.h @@ -1,26 +1,12 @@ -#ifndef NVIM_GARRAY_H -#define NVIM_GARRAY_H +#pragma once #include <stdbool.h> #include <stddef.h> +#include "nvim/garray_defs.h" // IWYU pragma: export #include "nvim/log.h" #include "nvim/memory.h" -#include "nvim/types.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_INIT_VALUE { 0, 0, 0, 1, NULL } -#define GA_INIT(itemsize, growsize) { 0, 0, (itemsize), (growsize), NULL } +#include "nvim/types_defs.h" #define GA_EMPTY(ga_ptr) ((ga_ptr)->ga_len <= 0) @@ -52,7 +38,7 @@ static inline void *ga_append_via_ptr(garray_T *gap, size_t item_size) /// /// @param gap the garray to be freed /// @param item_type type of the item in the garray -/// @param free_item_fn free function that takes (*item_type) as parameter +/// @param free_item_fn free function that takes (item_type *) as parameter #define GA_DEEP_CLEAR(gap, item_type, free_item_fn) \ do { \ garray_T *_gap = (gap); \ @@ -72,5 +58,3 @@ static inline void *ga_append_via_ptr(garray_T *gap, size_t item_size) /// /// @param gap the garray to be freed #define GA_DEEP_CLEAR_PTR(gap) GA_DEEP_CLEAR(gap, void *, FREE_PTR_PTR) - -#endif // NVIM_GARRAY_H |