mirror of
https://github.com/neovim/neovim.git
synced 2024-12-19 02:34:59 -07:00
refactor: move garray_T to garray_defs.h (#26227)
This commit is contained in:
parent
34509bbea3
commit
6361806aa2
2
Makefile
2
Makefile
@ -162,7 +162,6 @@ iwyu: build/.ran-cmake
|
||||
|src/nvim/api/window.h\
|
||||
|src/nvim/arabic.h\
|
||||
|src/nvim/arglist.h\
|
||||
|src/nvim/arglist_defs.h\
|
||||
|src/nvim/ascii.h\
|
||||
|src/nvim/assert.h\
|
||||
|src/nvim/autocmd.h\
|
||||
@ -313,7 +312,6 @@ iwyu: build/.ran-cmake
|
||||
|src/nvim/spell.h\
|
||||
|src/nvim/spell_defs.h\
|
||||
|src/nvim/spellfile.h\
|
||||
|src/nvim/spellsuggest.h\
|
||||
|src/nvim/state.h\
|
||||
|src/nvim/statusline.h\
|
||||
|src/nvim/statusline_defs.h\
|
||||
|
@ -198,11 +198,13 @@
|
||||
{ include: [ '"nvim/arglist_defs.h"', public, '"nvim/arglist.h"', public ] },
|
||||
{ include: [ '"nvim/buffer_defs.h"', public, '"nvim/buffer.h"', public ] },
|
||||
{ include: [ '"nvim/cmdexpand_defs.h"', public, '"nvim/cmdexpand.h"', public ] },
|
||||
{ include: [ '"nvim/decoration_defs.h"', public, '"nvim/decoration.h"', public ] },
|
||||
{ include: [ '"nvim/eval/typval_defs.h"', public, '"nvim/eval/typval.h"', public ] },
|
||||
{ include: [ '"nvim/ex_cmds_defs.h"', public, '"nvim/ex_cmds.h"', public ] },
|
||||
{ include: [ '"nvim/ex_eval_defs.h"', public, '"nvim/ex_eval.h"', public ] },
|
||||
{ include: [ '"nvim/extmark_defs.h"', public, '"nvim/extmark.h"', public ] },
|
||||
{ include: [ '"nvim/fold_defs.h"', public, '"nvim/fold.h"', public ] },
|
||||
{ include: [ '"nvim/garray_defs.h"', public, '"nvim/garray.h"', public ] },
|
||||
{ include: [ '"nvim/getchar_defs.h"', public, '"nvim/getchar.h"', public ] },
|
||||
{ include: [ '"nvim/grid_defs.h"', public, '"nvim/grid.h"', public ] },
|
||||
{ include: [ '"nvim/highlight_defs.h"', public, '"nvim/highlight.h"', public ] },
|
||||
|
@ -916,7 +916,6 @@ def CheckIncludes(filename, lines, error):
|
||||
"src/nvim/api/window.h",
|
||||
"src/nvim/arabic.h",
|
||||
"src/nvim/arglist.h",
|
||||
"src/nvim/arglist_defs.h",
|
||||
"src/nvim/ascii.h",
|
||||
"src/nvim/assert.h",
|
||||
"src/nvim/autocmd.h",
|
||||
@ -1067,7 +1066,6 @@ def CheckIncludes(filename, lines, error):
|
||||
"src/nvim/spell.h",
|
||||
"src/nvim/spell_defs.h",
|
||||
"src/nvim/spellfile.h",
|
||||
"src/nvim/spellsuggest.h",
|
||||
"src/nvim/state.h",
|
||||
"src/nvim/statusline.h",
|
||||
"src/nvim/statusline_defs.h",
|
||||
|
@ -13,7 +13,6 @@
|
||||
#include "nvim/api/vimscript.h"
|
||||
#include "nvim/buffer_defs.h"
|
||||
#include "nvim/decoration.h"
|
||||
#include "nvim/decoration_defs.h"
|
||||
#include "nvim/extmark.h"
|
||||
#include "nvim/globals.h"
|
||||
#include "nvim/highlight.h"
|
||||
|
@ -13,7 +13,6 @@
|
||||
#include "nvim/buffer_defs.h"
|
||||
#include "nvim/charset.h"
|
||||
#include "nvim/decoration.h"
|
||||
#include "nvim/decoration_defs.h"
|
||||
#include "nvim/decoration_provider.h"
|
||||
#include "nvim/drawscreen.h"
|
||||
#include "nvim/extmark.h"
|
||||
|
@ -11,7 +11,6 @@
|
||||
#include "nvim/autocmd.h"
|
||||
#include "nvim/buffer_defs.h"
|
||||
#include "nvim/decoration.h"
|
||||
#include "nvim/decoration_defs.h"
|
||||
#include "nvim/drawscreen.h"
|
||||
#include "nvim/globals.h"
|
||||
#include "nvim/grid.h"
|
||||
|
@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "nvim/garray.h"
|
||||
#include "nvim/garray_defs.h"
|
||||
|
||||
/// Argument list: Array of file names.
|
||||
/// Used for the global argument list and the argument lists local to a window.
|
||||
|
@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "auto/config.h"
|
||||
#include "nvim/log.h"
|
||||
|
||||
// support static asserts (aka compile-time asserts)
|
||||
|
||||
|
@ -19,7 +19,7 @@ typedef struct {
|
||||
#include "nvim/arglist_defs.h"
|
||||
#include "nvim/eval/typval_defs.h"
|
||||
#include "nvim/extmark_defs.h"
|
||||
#include "nvim/garray.h"
|
||||
#include "nvim/garray_defs.h"
|
||||
#include "nvim/grid_defs.h"
|
||||
#include "nvim/hashtab.h"
|
||||
#include "nvim/highlight_defs.h"
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include "nvim/event/rstream.h"
|
||||
#include "nvim/event/socket.h"
|
||||
#include "nvim/event/wstream.h"
|
||||
#include "nvim/garray.h"
|
||||
#include "nvim/gettext.h"
|
||||
#include "nvim/globals.h"
|
||||
#include "nvim/log.h"
|
||||
|
@ -10,7 +10,7 @@
|
||||
#include "nvim/event/process.h"
|
||||
#include "nvim/event/socket.h"
|
||||
#include "nvim/event/stream.h"
|
||||
#include "nvim/garray.h"
|
||||
#include "nvim/garray_defs.h"
|
||||
#include "nvim/macros.h"
|
||||
#include "nvim/main.h"
|
||||
#include "nvim/map.h"
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include "nvim/ex_docmd.h"
|
||||
#include "nvim/ex_getln.h"
|
||||
#include "nvim/garray.h"
|
||||
#include "nvim/garray_defs.h"
|
||||
#include "nvim/getchar.h"
|
||||
#include "nvim/gettext.h"
|
||||
#include "nvim/globals.h"
|
||||
|
@ -3,7 +3,7 @@
|
||||
#include "nvim/cmdexpand_defs.h"
|
||||
#include "nvim/eval/typval_defs.h"
|
||||
#include "nvim/ex_getln.h"
|
||||
#include "nvim/garray.h"
|
||||
#include "nvim/garray_defs.h"
|
||||
#include "nvim/types.h"
|
||||
|
||||
// Values for nextwild() and ExpandOne(). See ExpandOne() for meaning.
|
||||
|
@ -15,7 +15,6 @@
|
||||
#include "nvim/cursor.h"
|
||||
#include "nvim/cursor_shape.h"
|
||||
#include "nvim/decoration.h"
|
||||
#include "nvim/decoration_defs.h"
|
||||
#include "nvim/decoration_provider.h"
|
||||
#include "nvim/diff.h"
|
||||
#include "nvim/drawline.h"
|
||||
|
@ -68,7 +68,6 @@
|
||||
#include "nvim/cmdexpand.h"
|
||||
#include "nvim/cursor.h"
|
||||
#include "nvim/decoration.h"
|
||||
#include "nvim/decoration_defs.h"
|
||||
#include "nvim/decoration_provider.h"
|
||||
#include "nvim/diff.h"
|
||||
#include "nvim/digraph.h"
|
||||
|
@ -8,7 +8,7 @@
|
||||
#include "nvim/eval.h"
|
||||
#include "nvim/eval/typval.h"
|
||||
#include "nvim/eval/typval_defs.h"
|
||||
#include "nvim/garray.h"
|
||||
#include "nvim/garray_defs.h"
|
||||
#include "nvim/vim.h"
|
||||
|
||||
/// Convert Vimscript value to msgpack string
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include "nvim/eval/userfunc.h"
|
||||
#include "nvim/eval/vars.h"
|
||||
#include "nvim/garray.h"
|
||||
#include "nvim/garray_defs.h"
|
||||
#include "nvim/gettext.h"
|
||||
#include "nvim/globals.h"
|
||||
#include "nvim/hashtab.h"
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
#include "nvim/eval/typval_defs.h"
|
||||
#include "nvim/func_attr.h"
|
||||
#include "nvim/garray.h"
|
||||
#include "nvim/garray_defs.h"
|
||||
#include "nvim/gettext.h"
|
||||
#include "nvim/hashtab.h"
|
||||
#include "nvim/lib/queue.h"
|
||||
|
@ -3,7 +3,7 @@
|
||||
#include <inttypes.h>
|
||||
#include <limits.h>
|
||||
|
||||
#include "nvim/garray.h"
|
||||
#include "nvim/garray_defs.h"
|
||||
#include "nvim/hashtab.h"
|
||||
#include "nvim/lib/queue.h"
|
||||
#include "nvim/pos.h"
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include "nvim/ex_eval.h"
|
||||
#include "nvim/ex_getln.h"
|
||||
#include "nvim/garray.h"
|
||||
#include "nvim/garray_defs.h"
|
||||
#include "nvim/getchar.h"
|
||||
#include "nvim/gettext.h"
|
||||
#include "nvim/globals.h"
|
||||
|
@ -7,7 +7,7 @@
|
||||
#include "nvim/eval.h"
|
||||
#include "nvim/eval/typval_defs.h"
|
||||
#include "nvim/ex_cmds_defs.h"
|
||||
#include "nvim/garray.h"
|
||||
#include "nvim/garray_defs.h"
|
||||
#include "nvim/hashtab.h"
|
||||
#include "nvim/pos.h"
|
||||
#include "nvim/types.h"
|
||||
|
@ -31,7 +31,6 @@
|
||||
#include "nvim/buffer_defs.h"
|
||||
#include "nvim/buffer_updates.h"
|
||||
#include "nvim/decoration.h"
|
||||
#include "nvim/decoration_defs.h"
|
||||
#include "nvim/extmark.h"
|
||||
#include "nvim/extmark_defs.h"
|
||||
#include "nvim/globals.h"
|
||||
|
@ -31,6 +31,7 @@
|
||||
#include "nvim/fileio.h"
|
||||
#include "nvim/fold.h"
|
||||
#include "nvim/garray.h"
|
||||
#include "nvim/garray_defs.h"
|
||||
#include "nvim/getchar.h"
|
||||
#include "nvim/gettext.h"
|
||||
#include "nvim/globals.h"
|
||||
|
@ -3,7 +3,7 @@
|
||||
#include "nvim/buffer_defs.h"
|
||||
#include "nvim/eval/typval_defs.h"
|
||||
#include "nvim/ex_cmds_defs.h"
|
||||
#include "nvim/garray.h"
|
||||
#include "nvim/garray_defs.h"
|
||||
#include "nvim/globals.h"
|
||||
#include "nvim/os/fs_defs.h"
|
||||
#include "nvim/os/os.h"
|
||||
|
@ -20,7 +20,6 @@
|
||||
#include "nvim/charset.h"
|
||||
#include "nvim/cursor.h"
|
||||
#include "nvim/decoration.h"
|
||||
#include "nvim/decoration_defs.h"
|
||||
#include "nvim/diff.h"
|
||||
#include "nvim/drawscreen.h"
|
||||
#include "nvim/eval.h"
|
||||
@ -29,6 +28,7 @@
|
||||
#include "nvim/extmark.h"
|
||||
#include "nvim/fold.h"
|
||||
#include "nvim/garray.h"
|
||||
#include "nvim/garray_defs.h"
|
||||
#include "nvim/gettext.h"
|
||||
#include "nvim/globals.h"
|
||||
#include "nvim/indent.h"
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
#include "nvim/buffer_defs.h"
|
||||
#include "nvim/fold_defs.h"
|
||||
#include "nvim/garray.h"
|
||||
#include "nvim/garray_defs.h"
|
||||
#include "nvim/macros.h"
|
||||
#include "nvim/pos.h"
|
||||
#include "nvim/types.h"
|
||||
|
@ -3,24 +3,11 @@
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include "nvim/garray_defs.h"
|
||||
#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 }
|
||||
|
||||
#define GA_EMPTY(ga_ptr) ((ga_ptr)->ga_len <= 0)
|
||||
|
||||
#define GA_APPEND(item_type, gap, item) \
|
||||
|
17
src/nvim/garray_defs.h
Normal file
17
src/nvim/garray_defs.h
Normal file
@ -0,0 +1,17 @@
|
||||
#pragma once
|
||||
|
||||
#include <stddef.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 }
|
@ -12,6 +12,10 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#ifdef ENABLE_ASAN_UBSAN
|
||||
# include <sanitizer/asan_interface.h>
|
||||
# include <sanitizer/ubsan_interface.h>
|
||||
#endif
|
||||
|
||||
#include "nvim/arglist.h"
|
||||
#include "nvim/ascii.h"
|
||||
@ -2227,13 +2231,11 @@ static void check_swap_exists_action(void)
|
||||
}
|
||||
|
||||
#ifdef ENABLE_ASAN_UBSAN
|
||||
const char *__ubsan_default_options(void); // NOLINT(bugprone-reserved-identifier)
|
||||
const char *__ubsan_default_options(void)
|
||||
{
|
||||
return "print_stacktrace=1";
|
||||
}
|
||||
|
||||
const char *__asan_default_options(void); // NOLINT(bugprone-reserved-identifier)
|
||||
const char *__asan_default_options(void)
|
||||
{
|
||||
return "handle_abort=1,handle_sigill=1";
|
||||
|
@ -56,6 +56,7 @@
|
||||
// only for debug functions
|
||||
#include "nvim/api/private/defs.h"
|
||||
#include "nvim/api/private/helpers.h"
|
||||
#include "nvim/garray_defs.h"
|
||||
#include "nvim/macros.h"
|
||||
|
||||
#define T MT_BRANCH_FACTOR
|
||||
|
@ -8,7 +8,7 @@
|
||||
#include "klib/kvec.h"
|
||||
#include "nvim/assert.h"
|
||||
#include "nvim/decoration_defs.h"
|
||||
#include "nvim/garray.h"
|
||||
#include "nvim/garray_defs.h"
|
||||
#include "nvim/map.h"
|
||||
#include "nvim/pos.h"
|
||||
#include "nvim/types.h"
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
#include "nvim/buffer_defs.h"
|
||||
#include "nvim/cmdexpand_defs.h"
|
||||
#include "nvim/garray.h"
|
||||
#include "nvim/garray_defs.h"
|
||||
#include "nvim/os/fs_defs.h"
|
||||
#include "nvim/os/stdpaths_defs.h"
|
||||
#include "nvim/types.h"
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include "nvim/file_search.h"
|
||||
#include "nvim/fileio.h"
|
||||
#include "nvim/garray.h"
|
||||
#include "nvim/garray_defs.h"
|
||||
#include "nvim/gettext.h"
|
||||
#include "nvim/globals.h"
|
||||
#include "nvim/macros.h"
|
||||
|
@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "nvim/func_attr.h"
|
||||
#include "nvim/garray.h"
|
||||
#include "nvim/garray_defs.h"
|
||||
#include "nvim/types.h"
|
||||
|
||||
// Flags for expand_wildcards()
|
||||
|
@ -8,7 +8,6 @@
|
||||
#include "nvim/ascii.h"
|
||||
#include "nvim/charset.h"
|
||||
#include "nvim/decoration.h"
|
||||
#include "nvim/decoration_defs.h"
|
||||
#include "nvim/diff.h"
|
||||
#include "nvim/fold.h"
|
||||
#include "nvim/globals.h"
|
||||
|
@ -16,8 +16,6 @@
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
struct rbuffer;
|
||||
|
||||
// Macros that simplify working with the read/write pointers directly by hiding
|
||||
// ring buffer wrap logic. Some examples:
|
||||
//
|
||||
|
@ -8,7 +8,7 @@
|
||||
#include "nvim/eval/typval_defs.h"
|
||||
#include "nvim/ex_cmds_defs.h"
|
||||
#include "nvim/ex_eval_defs.h"
|
||||
#include "nvim/garray.h"
|
||||
#include "nvim/garray_defs.h"
|
||||
#include "nvim/option_defs.h"
|
||||
#include "nvim/pos.h"
|
||||
#include "nvim/types.h"
|
||||
|
@ -18,7 +18,6 @@
|
||||
#include "nvim/cmdexpand_defs.h"
|
||||
#include "nvim/cursor.h"
|
||||
#include "nvim/decoration.h"
|
||||
#include "nvim/decoration_defs.h"
|
||||
#include "nvim/drawscreen.h"
|
||||
#include "nvim/edit.h"
|
||||
#include "nvim/eval/funcs.h"
|
||||
|
@ -4,7 +4,7 @@
|
||||
#include <stdint.h>
|
||||
|
||||
#include "nvim/buffer_defs.h"
|
||||
#include "nvim/garray.h"
|
||||
#include "nvim/garray_defs.h"
|
||||
#include "nvim/regexp_defs.h"
|
||||
#include "nvim/types.h"
|
||||
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include "nvim/eval/typval.h"
|
||||
#include "nvim/fileio.h"
|
||||
#include "nvim/garray.h"
|
||||
#include "nvim/garray_defs.h"
|
||||
#include "nvim/getchar.h"
|
||||
#include "nvim/gettext.h"
|
||||
#include "nvim/globals.h"
|
||||
|
@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "nvim/garray.h"
|
||||
#include "nvim/garray_defs.h"
|
||||
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
# include "spellsuggest.h.generated.h"
|
||||
|
@ -5,7 +5,7 @@
|
||||
#include "nvim/cmdexpand_defs.h"
|
||||
#include "nvim/eval/typval_defs.h"
|
||||
#include "nvim/ex_cmds_defs.h"
|
||||
#include "nvim/garray.h"
|
||||
#include "nvim/garray_defs.h"
|
||||
#include "nvim/types.h"
|
||||
|
||||
typedef struct ucmd {
|
||||
|
Loading…
Reference in New Issue
Block a user