aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/garray.h
diff options
context:
space:
mode:
authorEliseo Martínez <eliseomarmol@gmail.com>2014-05-12 02:25:17 +0200
committerEliseo Martínez <eliseomarmol@gmail.com>2014-05-15 20:46:01 +0200
commitda51dc9cf202772f60bd2da975dbef257bd9237c (patch)
tree5c16b93238a153f55634e9323077f30c8133970c /src/nvim/garray.h
parentffe61e5ba1721340ca51d56bae3ddaca415fb5bc (diff)
downloadrneovim-da51dc9cf202772f60bd2da975dbef257bd9237c.tar.gz
rneovim-da51dc9cf202772f60bd2da975dbef257bd9237c.tar.bz2
rneovim-da51dc9cf202772f60bd2da975dbef257bd9237c.zip
Introduce nvim namespace: Move files.
Move files from src/ to src/nvim/. - src/nvim/ becomes the new root dir for nvim executable sources. - src/libnvim/ is planned to become root dir of the neovim library.
Diffstat (limited to 'src/nvim/garray.h')
-rw-r--r--src/nvim/garray.h31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/nvim/garray.h b/src/nvim/garray.h
new file mode 100644
index 0000000000..2a0deacef7
--- /dev/null
+++ b/src/nvim/garray.h
@@ -0,0 +1,31 @@
+#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