aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/garray.h
diff options
context:
space:
mode:
authorJosh Rahm <joshuarahm@gmail.com>2023-11-30 20:35:25 +0000
committerJosh Rahm <joshuarahm@gmail.com>2023-11-30 20:35:25 +0000
commit1b7b916b7631ddf73c38e3a0070d64e4636cb2f3 (patch)
treecd08258054db80bb9a11b1061bb091c70b76926a /src/nvim/garray.h
parenteaa89c11d0f8aefbb512de769c6c82f61a8baca3 (diff)
parent4a8bf24ac690004aedf5540fa440e788459e5e34 (diff)
downloadrneovim-1b7b916b7631ddf73c38e3a0070d64e4636cb2f3.tar.gz
rneovim-1b7b916b7631ddf73c38e3a0070d64e4636cb2f3.tar.bz2
rneovim-1b7b916b7631ddf73c38e3a0070d64e4636cb2f3.zip
Merge remote-tracking branch 'upstream/master' into aucmd_textputpostaucmd_textputpost
Diffstat (limited to 'src/nvim/garray.h')
-rw-r--r--src/nvim/garray.h24
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