aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordundargoc <33953936+dundargoc@users.noreply.github.com>2021-10-30 02:23:20 +0200
committerGitHub <noreply@github.com>2021-10-29 17:23:20 -0700
commit4472c56d54f447040f6e8610b261b7efa0d04eb6 (patch)
treefcc56104bc56529999bd18e90ecef1c80711ecf0
parent16d06fa3eb74ed96b659736ea504c31ed81c325e (diff)
downloadrneovim-4472c56d54f447040f6e8610b261b7efa0d04eb6.tar.gz
rneovim-4472c56d54f447040f6e8610b261b7efa0d04eb6.tar.bz2
rneovim-4472c56d54f447040f6e8610b261b7efa0d04eb6.zip
refactor: uncrustify #16090
-rw-r--r--src/nvim/api/private/defs.h2
-rw-r--r--src/nvim/api/vim.c20
-rw-r--r--src/nvim/ascii.h2
-rw-r--r--src/nvim/assert.h10
-rw-r--r--src/nvim/buffer.c2
-rw-r--r--src/nvim/buffer.h2
-rw-r--r--src/nvim/buffer_defs.h2
-rw-r--r--src/nvim/channel.h4
-rw-r--r--src/nvim/cursor_shape.h4
-rw-r--r--src/nvim/diff.c4
-rw-r--r--src/nvim/edit.c2
-rw-r--r--src/nvim/eval.h2
-rw-r--r--src/nvim/eval/encode.c2
-rw-r--r--src/nvim/eval/typval.h2
-rw-r--r--src/nvim/event/process.h2
-rw-r--r--src/nvim/ex_cmds2.c2
-rw-r--r--src/nvim/ex_cmds_defs.h2
-rw-r--r--src/nvim/ex_docmd.c2
-rw-r--r--src/nvim/ex_getln.c2
-rw-r--r--src/nvim/getchar.h4
-rw-r--r--src/nvim/globals.h2
-rw-r--r--src/nvim/highlight_defs.h2
-rw-r--r--src/nvim/if_cscope.c2
-rw-r--r--src/nvim/if_cscope_defs.h4
-rw-r--r--src/nvim/keymap.h2
-rw-r--r--src/nvim/lib/kbtree.h400
-rw-r--r--src/nvim/lib/khash.h38
-rw-r--r--src/nvim/lib/ringbuf.h12
-rw-r--r--src/nvim/macros.h8
-rw-r--r--src/nvim/map.c16
-rw-r--r--src/nvim/map.h2
-rw-r--r--src/nvim/memline.c2
-rw-r--r--src/nvim/message.c2
-rw-r--r--src/nvim/normal.h2
-rw-r--r--src/nvim/ops.h2
-rw-r--r--src/nvim/option.c2
-rw-r--r--src/nvim/option_defs.h4
-rw-r--r--src/nvim/os/fileio.h2
-rw-r--r--src/nvim/os/input.c2
-rw-r--r--src/nvim/os/pty_process_win.h2
-rw-r--r--src/nvim/path.h2
-rw-r--r--src/nvim/pos.h8
-rw-r--r--src/nvim/quickfix.c2
-rw-r--r--src/nvim/spell_defs.h2
-rw-r--r--src/nvim/syntax.c2
-rw-r--r--src/nvim/tag.c2
-rw-r--r--src/nvim/tui/tui.c1
-rw-r--r--src/nvim/version.c4
-rw-r--r--src/nvim/vim.h4
-rw-r--r--src/nvim/viml/parser/expressions.c2
-rw-r--r--src/uncrustify.cfg6
51 files changed, 291 insertions, 326 deletions
diff --git a/src/nvim/api/private/defs.h b/src/nvim/api/private/defs.h
index 663d1e16b5..396fab721d 100644
--- a/src/nvim/api/private/defs.h
+++ b/src/nvim/api/private/defs.h
@@ -26,7 +26,7 @@
typedef enum {
kErrorTypeNone = -1,
kErrorTypeException,
- kErrorTypeValidation
+ kErrorTypeValidation,
} ErrorType;
typedef enum {
diff --git a/src/nvim/api/vim.c b/src/nvim/api/vim.c
index 3ca6189ddd..f51b5536e7 100644
--- a/src/nvim/api/vim.c
+++ b/src/nvim/api/vim.c
@@ -1728,7 +1728,6 @@ static void write_msg(String message, bool to_err)
pos = 0; \
continue; \
} \
- \
line_buf[pos++] = message.data[i];
++no_wait_return;
@@ -2182,16 +2181,15 @@ Dictionary nvim_eval_statusline(String str, Dict(eval_statusline) *opts, Error *
int p_crb_save = ewp->w_p_crb;
ewp->w_p_crb = false;
- int width = build_stl_str_hl(
- ewp,
- (char_u *)buf,
- sizeof(buf),
- (char_u *)str.data,
- false,
- (char_u)fillchar,
- maxwidth,
- hltab_ptr,
- NULL);
+ int width = build_stl_str_hl(ewp,
+ (char_u *)buf,
+ sizeof(buf),
+ (char_u *)str.data,
+ false,
+ (char_u)fillchar,
+ maxwidth,
+ hltab_ptr,
+ NULL);
PUT(result, "width", INTEGER_OBJ(width));
diff --git a/src/nvim/ascii.h b/src/nvim/ascii.h
index 44ed94d2fc..2cabaa43ef 100644
--- a/src/nvim/ascii.h
+++ b/src/nvim/ascii.h
@@ -10,7 +10,7 @@
// Definitions of various common control characters.
#define CharOrd(x) ((uint8_t)(x) < 'a' \
- ? (uint8_t)(x) - 'A'\
+ ? (uint8_t)(x) - 'A' \
: (uint8_t)(x) - 'a')
#define CharOrdLow(x) ((uint8_t)(x) - 'a')
#define CharOrdUp(x) ((uint8_t)(x) - 'A')
diff --git a/src/nvim/assert.h b/src/nvim/assert.h
index fc1a4be164..ad92d9a2af 100644
--- a/src/nvim/assert.h
+++ b/src/nvim/assert.h
@@ -70,11 +70,11 @@
# if __GNUC__ >= 6
# define STATIC_ASSERT_PRAGMA_START \
- _Pragma("GCC diagnostic push")\
+ _Pragma("GCC diagnostic push") \
_Pragma("GCC diagnostic ignored \"-Wpedantic\"")
# else
# define STATIC_ASSERT_PRAGMA_START \
- _Pragma("GCC diagnostic push")\
+ _Pragma("GCC diagnostic push") \
_Pragma("GCC diagnostic ignored \"-pedantic\"")
# endif
@@ -89,7 +89,7 @@
# undef STATIC_ASSERT_PRAGMA_START
# define STATIC_ASSERT_PRAGMA_START \
- _Pragma("clang diagnostic push")\
+ _Pragma("clang diagnostic push") \
_Pragma("clang diagnostic ignored \"-Wc11-extensions\"")
# undef STATIC_ASSERT_PRAGMA_END
@@ -113,14 +113,14 @@
// These can't be used after statements in c89.
#ifdef __COUNTER__
# define STATIC_ASSERT_EXPR(e, m) \
- ((enum { ASSERT_CONCAT(static_assert_, __COUNTER__) = 1/(!!(e)) }) 0)
+ ((enum { ASSERT_CONCAT(static_assert_, __COUNTER__) = 1/(!!(e)), }) 0)
#else
// This can't be used twice on the same line so ensure if using in headers
// that the headers are not included twice (by wrapping in #ifndef...#endif)
// Note it doesn't cause an issue when used on same line of separate modules
// compiled with gcc -combine -fwhole-program.
# define STATIC_ASSERT_EXPR(e, m) \
- ((enum { ASSERT_CONCAT(assert_line_, __LINE__) = 1/(!!(e)) }) 0)
+ ((enum { ASSERT_CONCAT(assert_line_, __LINE__) = 1/(!!(e)), }) 0)
#endif
/// @def STRICT_ADD
diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c
index 37a2060021..943d5fe6b5 100644
--- a/src/nvim/buffer.c
+++ b/src/nvim/buffer.c
@@ -3399,7 +3399,7 @@ void free_titles(void)
/// be used when printing numbers in the status line.
typedef enum {
kNumBaseDecimal = 10,
- kNumBaseHexadecimal = 16
+ kNumBaseHexadecimal = 16,
} NumberBase;
diff --git a/src/nvim/buffer.h b/src/nvim/buffer.h
index 0484c8550d..9e2ca999e4 100644
--- a/src/nvim/buffer.h
+++ b/src/nvim/buffer.h
@@ -24,7 +24,7 @@ enum getf_retvalues {
GETFILE_NOT_WRITTEN = 2, // "not written" error
GETFILE_SAME_FILE = 0, // success, same file
GETFILE_OPEN_OTHER = -1, // success, opened another file
- GETFILE_UNUSED = 8
+ GETFILE_UNUSED = 8,
};
// Values for buflist_new() flags
diff --git a/src/nvim/buffer_defs.h b/src/nvim/buffer_defs.h
index c0a0376088..31feeb91cf 100644
--- a/src/nvim/buffer_defs.h
+++ b/src/nvim/buffer_defs.h
@@ -388,7 +388,7 @@ struct stl_item {
Highlight,
TabPage,
ClickFunc,
- Trunc
+ Trunc,
} type;
};
diff --git a/src/nvim/channel.h b/src/nvim/channel.h
index 8d14f465c1..81b75e2d31 100644
--- a/src/nvim/channel.h
+++ b/src/nvim/channel.h
@@ -17,7 +17,7 @@ typedef enum {
kChannelStreamSocket,
kChannelStreamStdio,
kChannelStreamStderr,
- kChannelStreamInternal
+ kChannelStreamInternal,
} ChannelStreamType;
typedef enum {
@@ -25,7 +25,7 @@ typedef enum {
kChannelPartStdout,
kChannelPartStderr,
kChannelPartRpc,
- kChannelPartAll
+ kChannelPartAll,
} ChannelPart;
typedef enum {
diff --git a/src/nvim/cursor_shape.h b/src/nvim/cursor_shape.h
index 06eaa431a0..93bddd47c7 100644
--- a/src/nvim/cursor_shape.h
+++ b/src/nvim/cursor_shape.h
@@ -24,13 +24,13 @@ typedef enum {
SHAPE_IDX_MORE = 14, ///< Hit-return or More
SHAPE_IDX_MOREL = 15, ///< Hit-return or More in last line
SHAPE_IDX_SM = 16, ///< showing matching paren
- SHAPE_IDX_COUNT = 17
+ SHAPE_IDX_COUNT = 17,
} ModeShape;
typedef enum {
SHAPE_BLOCK = 0, ///< block cursor
SHAPE_HOR = 1, ///< horizontal bar cursor
- SHAPE_VER = 2 ///< vertical bar cursor
+ SHAPE_VER = 2, ///< vertical bar cursor
} CursorShape;
#define MSHAPE_NUMBERED 1000 // offset for shapes identified by number
diff --git a/src/nvim/diff.c b/src/nvim/diff.c
index efbc2fd0db..7c33f0cab6 100644
--- a/src/nvim/diff.c
+++ b/src/nvim/diff.c
@@ -1536,7 +1536,7 @@ static void diff_read(int idx_orig, int idx_new, diffout_T *dout)
enum {
DIFF_ED,
DIFF_UNIFIED,
- DIFF_NONE
+ DIFF_NONE,
} diffstyle = DIFF_NONE;
if (dout->dout_fname == NULL) {
@@ -1708,7 +1708,7 @@ static void diff_read(int idx_orig, int idx_new, diffout_T *dout)
notset = false; // "*dp" has been set
}
- // for remaining diff blocks orig and new are equal
+// for remaining diff blocks orig and new are equal
while (dp != NULL) {
if (notset) {
diff_copy_entry(dprev, dp, idx_orig, idx_new);
diff --git a/src/nvim/edit.c b/src/nvim/edit.c
index 0cfda53091..4542576339 100644
--- a/src/nvim/edit.c
+++ b/src/nvim/edit.c
@@ -7621,7 +7621,7 @@ int hkmap(int c)
enum {
hALEF = 0, BET, GIMEL, DALET, HEI, VAV, ZAIN, HET, TET, IUD,
KAFsofit, hKAF, LAMED, MEMsofit, MEM, NUNsofit, NUN, SAMEH, AIN,
- PEIsofit, PEI, ZADIsofit, ZADI, KOF, RESH, hSHIN, TAV
+ PEIsofit, PEI, ZADIsofit, ZADI, KOF, RESH, hSHIN, TAV,
};
static char_u map[26] =
{ (char_u)hALEF /*a*/, (char_u)BET /*b*/, (char_u)hKAF /*c*/,
diff --git a/src/nvim/eval.h b/src/nvim/eval.h
index 3d656656de..d34348a274 100644
--- a/src/nvim/eval.h
+++ b/src/nvim/eval.h
@@ -70,7 +70,7 @@ typedef struct lval_S {
typedef enum {
VAR_FLAVOUR_DEFAULT = 1, // doesn't start with uppercase
VAR_FLAVOUR_SESSION = 2, // starts with uppercase, some lower
- VAR_FLAVOUR_SHADA = 4 // all uppercase
+ VAR_FLAVOUR_SHADA = 4, // all uppercase
} var_flavour_T;
/// Defines for Vim variables
diff --git a/src/nvim/eval/encode.c b/src/nvim/eval/encode.c
index 2d4d9fdea9..627b4465db 100644
--- a/src/nvim/eval/encode.c
+++ b/src/nvim/eval/encode.c
@@ -381,7 +381,7 @@ int encode_read_from_list(ListReaderState *const state, char *const buf, const s
} else { \
ga_concat(gap, "function("); \
TYPVAL_ENCODE_CONV_STRING(tv, fun_, strlen(fun_)); \
- }\
+ } \
} while (0)
#define TYPVAL_ENCODE_CONV_FUNC_BEFORE_ARGS(tv, len) \
diff --git a/src/nvim/eval/typval.h b/src/nvim/eval/typval.h
index a28feffd0b..994bce899d 100644
--- a/src/nvim/eval/typval.h
+++ b/src/nvim/eval/typval.h
@@ -30,7 +30,7 @@ typedef uint64_t uvarnumber_T;
typedef double float_T;
/// Refcount for dict or list that should not be freed
-enum { DO_NOT_FREE_CNT = (INT_MAX / 2) };
+enum { DO_NOT_FREE_CNT = (INT_MAX / 2), };
/// Additional values for tv_list_alloc() len argument
enum ListLenSpecials {
diff --git a/src/nvim/event/process.h b/src/nvim/event/process.h
index 2b22cd95dc..c20feb2c7a 100644
--- a/src/nvim/event/process.h
+++ b/src/nvim/event/process.h
@@ -8,7 +8,7 @@
typedef enum {
kProcessTypeUv,
- kProcessTypePty
+ kProcessTypePty,
} ProcessType;
typedef struct process Process;
diff --git a/src/nvim/ex_cmds2.c b/src/nvim/ex_cmds2.c
index 5d40d7a16a..e169514e79 100644
--- a/src/nvim/ex_cmds2.c
+++ b/src/nvim/ex_cmds2.c
@@ -198,7 +198,7 @@ void ex_perldo(exarg_T *eap)
// Command line expansion for :profile.
static enum {
PEXP_SUBCMD, ///< expand :profile sub-commands
- PEXP_FUNC ///< expand :profile func {funcname}
+ PEXP_FUNC, ///< expand :profile func {funcname}
} pexpand_what;
static char *pexpand_cmds[] = {
diff --git a/src/nvim/ex_cmds_defs.h b/src/nvim/ex_cmds_defs.h
index 171f8ed5cd..3d6d17aee1 100644
--- a/src/nvim/ex_cmds_defs.h
+++ b/src/nvim/ex_cmds_defs.h
@@ -78,7 +78,7 @@ typedef enum {
ADDR_QUICKFIX, // quickfix list entry number
ADDR_UNSIGNED, // positive count or zero, defaults to 1
ADDR_OTHER, // something else, use line number for '$', '%', etc.
- ADDR_NONE // no range used
+ ADDR_NONE, // no range used
} cmd_addr_T;
typedef struct exarg exarg_T;
diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c
index 532f8aa9b3..160ef9cfaa 100644
--- a/src/nvim/ex_docmd.c
+++ b/src/nvim/ex_docmd.c
@@ -5868,7 +5868,7 @@ static size_t uc_check_code(char_u *code, size_t len, char_u *buf, ucmd_T *cmd,
ct_MODS,
ct_REGISTER,
ct_LT,
- ct_NONE
+ ct_NONE,
} type = ct_NONE;
if ((vim_strchr((char_u *)"qQfF", *p) != NULL) && p[1] == '-') {
diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c
index 79c36576d5..6b8b9c30b1 100644
--- a/src/nvim/ex_getln.c
+++ b/src/nvim/ex_getln.c
@@ -2655,7 +2655,7 @@ void free_arshape_buf(void)
#endif
-enum { MAX_CB_ERRORS = 1 };
+enum { MAX_CB_ERRORS = 1, };
/// Color expression cmdline using built-in expressions parser
///
diff --git a/src/nvim/getchar.h b/src/nvim/getchar.h
index 4e9dd2eab7..5950611d3f 100644
--- a/src/nvim/getchar.h
+++ b/src/nvim/getchar.h
@@ -21,7 +21,7 @@ enum RemapValues {
typedef enum {
FLUSH_MINIMAL,
FLUSH_TYPEAHEAD, // flush current typebuf contents
- FLUSH_INPUT // flush typebuf and inchar() input
+ FLUSH_INPUT, // flush typebuf and inchar() input
} flush_buffers_T;
/// All possible |:map-arguments| usable in a |:map| command.
@@ -63,7 +63,7 @@ typedef struct map_arguments MapArguments;
#define KEYLEN_PART_MAP -2 // keylen value for incomplete mapping
/// Maximum number of streams to read script from
-enum { NSCRIPT = 15 };
+enum { NSCRIPT = 15, };
/// Streams to read script from
extern FileDescriptor *scriptin[NSCRIPT];
diff --git a/src/nvim/globals.h b/src/nvim/globals.h
index 21e186ec8c..49ad5fd1ae 100644
--- a/src/nvim/globals.h
+++ b/src/nvim/globals.h
@@ -1025,7 +1025,7 @@ EXTERN bool headless_mode INIT(= false);
typedef enum {
kUnknown,
kWorking,
- kBroken
+ kBroken,
} WorkingStatus;
/// The scope of a working-directory command like `:cd`.
diff --git a/src/nvim/highlight_defs.h b/src/nvim/highlight_defs.h
index 12f2b62313..d4d53c4126 100644
--- a/src/nvim/highlight_defs.h
+++ b/src/nvim/highlight_defs.h
@@ -103,7 +103,7 @@ typedef enum {
HLF_NFLOAT, // Floating window
HLF_MSG, // Message area
HLF_BORDER, // Floating window border
- HLF_COUNT // MUST be the last one
+ HLF_COUNT, // MUST be the last one
} hlf_T;
EXTERN const char *hlf_names[] INIT(= {
diff --git a/src/nvim/if_cscope.c b/src/nvim/if_cscope.c
index d731e79473..ea305188f2 100644
--- a/src/nvim/if_cscope.c
+++ b/src/nvim/if_cscope.c
@@ -72,7 +72,7 @@ static enum {
EXP_CSCOPE_SUBCMD, // expand ":cscope" sub-commands
EXP_SCSCOPE_SUBCMD, // expand ":scscope" sub-commands
EXP_CSCOPE_FIND, // expand ":cscope find" arguments
- EXP_CSCOPE_KILL // expand ":cscope kill" arguments
+ EXP_CSCOPE_KILL, // expand ":cscope kill" arguments
} expand_what;
/*
diff --git a/src/nvim/if_cscope_defs.h b/src/nvim/if_cscope_defs.h
index 182cbc28e1..6ded89fa0b 100644
--- a/src/nvim/if_cscope_defs.h
+++ b/src/nvim/if_cscope_defs.h
@@ -52,13 +52,13 @@ typedef struct csi {
FILE *to_fp; // to cscope: FILE.
} csinfo_T;
-typedef enum { Add, Find, Help, Kill, Reset, Show } csid_e;
+typedef enum { Add, Find, Help, Kill, Reset, Show, } csid_e;
typedef enum {
Store,
Get,
Free,
- Print
+ Print,
} mcmd_e;
#endif // NVIM_IF_CSCOPE_DEFS_H
diff --git a/src/nvim/keymap.h b/src/nvim/keymap.h
index 663a7a12ec..5ff5a38614 100644
--- a/src/nvim/keymap.h
+++ b/src/nvim/keymap.h
@@ -245,7 +245,7 @@ enum key_extra {
KE_MOUSEMOVE = 100, // mouse moved with no button down
// , KE_CANCEL = 101 // return from vgetc
KE_EVENT = 102, // event
- KE_COMMAND = 104 // <Cmd> special key
+ KE_COMMAND = 104, // <Cmd> special key
};
/*
diff --git a/src/nvim/lib/kbtree.h b/src/nvim/lib/kbtree.h
index e2a4e9edea..5d9c1095bc 100644
--- a/src/nvim/lib/kbtree.h
+++ b/src/nvim/lib/kbtree.h
@@ -46,20 +46,18 @@
#define __KB_KEY(type, x) (x->key)
#define __KB_PTR(btr, x) (x->ptr)
-#define __KB_TREE_T(name, key_t, T) \
- typedef struct kbnode_##name##_s kbnode_##name##_t; \
- struct kbnode_##name##_s { \
+#define __KB_TREE_T(name, key_t, T) \
+ typedef struct kbnode_##name##_s kbnode_##name##_t; \
+ struct kbnode_##name##_s { \
int32_t n; \
bool is_internal; \
key_t key[2*T-1]; \
kbnode_##name##_t *ptr[]; \
} ; \
- \
typedef struct { \
kbnode_##name##_t *root; \
int n_keys, n_nodes; \
} kbtree_##name##_t; \
- \
typedef struct { \
kbnode_##name##_t *x; \
int i; \
@@ -69,231 +67,231 @@
} kbitr_##name##_t; \
-#define __kb_destroy(kbnode_t, b) do { \
- int i; \
- unsigned int max = 8; \
- kbnode_t *x, **top, **stack = 0; \
- if (b->root) { \
- top = stack = (kbnode_t **)xcalloc(max, sizeof(kbnode_t *)); \
- *top++ = (b)->root; \
- while (top != stack) { \
- x = *--top; \
- if (x->is_internal == 0) { XFREE_CLEAR(x); continue; } \
- for (i = 0; i <= x->n; ++i) \
- if (__KB_PTR(b, x)[i]) { \
- if (top - stack == (int)max) { \
- max <<= 1; \
+#define __kb_destroy(kbnode_t, b) do { \
+ int i; \
+ unsigned int max = 8; \
+ kbnode_t *x, **top, **stack = 0; \
+ if (b->root) { \
+ top = stack = (kbnode_t **)xcalloc(max, sizeof(kbnode_t *)); \
+ *top++ = (b)->root; \
+ while (top != stack) { \
+ x = *--top; \
+ if (x->is_internal == 0) { XFREE_CLEAR(x); continue; } \
+ for (i = 0; i <= x->n; ++i) \
+ if (__KB_PTR(b, x)[i]) { \
+ if (top - stack == (int)max) { \
+ max <<= 1; \
stack = (kbnode_t **)xrealloc(stack, max * sizeof(kbnode_t *)); \
- top = stack + (max>>1); \
- } \
- *top++ = __KB_PTR(b, x)[i]; \
- } \
- XFREE_CLEAR(x); \
- } \
- } \
- XFREE_CLEAR(stack); \
+ top = stack + (max>>1); \
+ } \
+ *top++ = __KB_PTR(b, x)[i]; \
+ } \
+ XFREE_CLEAR(x); \
+ } \
+ } \
+ XFREE_CLEAR(stack); \
} while (0)
-#define __KB_GET_AUX1(name, key_t, kbnode_t, __cmp) \
+#define __KB_GET_AUX1(name, key_t, kbnode_t, __cmp) \
static inline int __kb_getp_aux_##name(const kbnode_t * __restrict x, key_t * __restrict k, \
int *r) \
- { \
- int tr, *rr, begin = 0, end = x->n; \
- if (x->n == 0) return -1; \
- rr = r? r : &tr; \
- while (begin < end) { \
- int mid = (begin + end) >> 1; \
+ { \
+ int tr, *rr, begin = 0, end = x->n; \
+ if (x->n == 0) return -1; \
+ rr = r? r : &tr; \
+ while (begin < end) { \
+ int mid = (begin + end) >> 1; \
if (__cmp(__KB_KEY(key_t, x)[mid], *k) < 0) begin = mid + 1; \
- else end = mid; \
- } \
- if (begin == x->n) { *rr = 1; return x->n - 1; } \
- if ((*rr = __cmp(*k, __KB_KEY(key_t, x)[begin])) < 0) --begin; \
- return begin; \
+ else end = mid; \
+ } \
+ if (begin == x->n) { *rr = 1; return x->n - 1; } \
+ if ((*rr = __cmp(*k, __KB_KEY(key_t, x)[begin])) < 0) --begin; \
+ return begin; \
}
-#define __KB_GET(name, key_t, kbnode_t) \
+#define __KB_GET(name, key_t, kbnode_t) \
static key_t *kb_getp_##name(kbtree_##name##_t *b, key_t * __restrict k) \
- { \
+ { \
if (!b->root) { \
return 0; \
} \
- int i, r = 0; \
- kbnode_t *x = b->root; \
- while (x) { \
- i = __kb_getp_aux_##name(x, k, &r); \
- if (i >= 0 && r == 0) return &__KB_KEY(key_t, x)[i]; \
- if (x->is_internal == 0) return 0; \
- x = __KB_PTR(b, x)[i + 1]; \
- } \
- return 0; \
- } \
+ int i, r = 0; \
+ kbnode_t *x = b->root; \
+ while (x) { \
+ i = __kb_getp_aux_##name(x, k, &r); \
+ if (i >= 0 && r == 0) return &__KB_KEY(key_t, x)[i]; \
+ if (x->is_internal == 0) return 0; \
+ x = __KB_PTR(b, x)[i + 1]; \
+ } \
+ return 0; \
+ } \
static inline key_t *kb_get_##name(kbtree_##name##_t *b, key_t k) \
- { \
- return kb_getp_##name(b, &k); \
+ { \
+ return kb_getp_##name(b, &k); \
}
-#define __KB_INTERVAL(name, key_t, kbnode_t) \
+#define __KB_INTERVAL(name, key_t, kbnode_t) \
static inline void kb_intervalp_##name(kbtree_##name##_t *b, key_t * __restrict k, key_t **lower, \
- key_t **upper) \
- { \
+ key_t **upper) \
+ { \
if (!b->root) { \
return; \
} \
- int i, r = 0; \
- kbnode_t *x = b->root; \
- *lower = *upper = 0; \
- while (x) { \
- i = __kb_getp_aux_##name(x, k, &r); \
- if (i >= 0 && r == 0) { \
- *lower = *upper = &__KB_KEY(key_t, x)[i]; \
- return; \
- } \
- if (i >= 0) *lower = &__KB_KEY(key_t, x)[i]; \
- if (i < x->n - 1) *upper = &__KB_KEY(key_t, x)[i + 1]; \
- if (x->is_internal == 0) return; \
- x = __KB_PTR(b, x)[i + 1]; \
- } \
- } \
+ int i, r = 0; \
+ kbnode_t *x = b->root; \
+ *lower = *upper = 0; \
+ while (x) { \
+ i = __kb_getp_aux_##name(x, k, &r); \
+ if (i >= 0 && r == 0) { \
+ *lower = *upper = &__KB_KEY(key_t, x)[i]; \
+ return; \
+ } \
+ if (i >= 0) *lower = &__KB_KEY(key_t, x)[i]; \
+ if (i < x->n - 1) *upper = &__KB_KEY(key_t, x)[i + 1]; \
+ if (x->is_internal == 0) return; \
+ x = __KB_PTR(b, x)[i + 1]; \
+ } \
+ } \
static inline void kb_interval_##name(kbtree_##name##_t *b, key_t k, key_t **lower, key_t **upper) \
- { \
- kb_intervalp_##name(b, &k, lower, upper); \
+ { \
+ kb_intervalp_##name(b, &k, lower, upper); \
}
-#define __KB_PUT(name, key_t, kbnode_t, __cmp, T, ILEN) \
- /* x must be an internal node */ \
+#define __KB_PUT(name, key_t, kbnode_t, __cmp, T, ILEN) \
+ /* x must be an internal node */ \
static inline void __kb_split_##name(kbtree_##name##_t *b, kbnode_t *x, int i, kbnode_t *y) \
- { \
- kbnode_t *z; \
- z = (kbnode_t *)xcalloc(1, y->is_internal? ILEN : sizeof(kbnode_##name##_t)); \
- ++b->n_nodes; \
- z->is_internal = y->is_internal; \
- z->n = T - 1; \
+ { \
+ kbnode_t *z; \
+ z = (kbnode_t *)xcalloc(1, y->is_internal? ILEN : sizeof(kbnode_##name##_t)); \
+ ++b->n_nodes; \
+ z->is_internal = y->is_internal; \
+ z->n = T - 1; \
memcpy(__KB_KEY(key_t, z), &__KB_KEY(key_t, y)[T], sizeof(key_t) * (T - 1)); \
if (y->is_internal) memcpy(__KB_PTR(b, z), &__KB_PTR(b, y)[T], sizeof(void *) * T); \
- y->n = T - 1; \
+ y->n = T - 1; \
memmove(&__KB_PTR(b, x)[i + 2], &__KB_PTR(b, \
x)[i + 1], sizeof(void *) * (unsigned int)(x->n - i)); \
- __KB_PTR(b, x)[i + 1] = z; \
+ __KB_PTR(b, x)[i + 1] = z; \
memmove(&__KB_KEY(key_t, x)[i + 1], &__KB_KEY(key_t, x)[i], \
sizeof(key_t) * (unsigned int)(x->n - i)); \
- __KB_KEY(key_t, x)[i] = __KB_KEY(key_t, y)[T - 1]; \
- ++x->n; \
- } \
+ __KB_KEY(key_t, x)[i] = __KB_KEY(key_t, y)[T - 1]; \
+ ++x->n; \
+ } \
static inline key_t *__kb_putp_aux_##name(kbtree_##name##_t *b, kbnode_t *x, key_t * __restrict k) \
- { \
- int i = x->n - 1; \
- key_t *ret; \
- if (x->is_internal == 0) { \
- i = __kb_getp_aux_##name(x, k, 0); \
- if (i != x->n - 1) \
+ { \
+ int i = x->n - 1; \
+ key_t *ret; \
+ if (x->is_internal == 0) { \
+ i = __kb_getp_aux_##name(x, k, 0); \
+ if (i != x->n - 1) \
memmove(&__KB_KEY(key_t, x)[i + 2], &__KB_KEY(key_t, \
x)[i + 1], \
(unsigned int)(x->n - i - 1) * sizeof(key_t)); \
- ret = &__KB_KEY(key_t, x)[i + 1]; \
- *ret = *k; \
- ++x->n; \
- } else { \
- i = __kb_getp_aux_##name(x, k, 0) + 1; \
- if (__KB_PTR(b, x)[i]->n == 2 * T - 1) { \
- __kb_split_##name(b, x, i, __KB_PTR(b, x)[i]); \
- if (__cmp(*k, __KB_KEY(key_t, x)[i]) > 0) ++i; \
- } \
- ret = __kb_putp_aux_##name(b, __KB_PTR(b, x)[i], k); \
- } \
- return ret; \
- } \
+ ret = &__KB_KEY(key_t, x)[i + 1]; \
+ *ret = *k; \
+ ++x->n; \
+ } else { \
+ i = __kb_getp_aux_##name(x, k, 0) + 1; \
+ if (__KB_PTR(b, x)[i]->n == 2 * T - 1) { \
+ __kb_split_##name(b, x, i, __KB_PTR(b, x)[i]); \
+ if (__cmp(*k, __KB_KEY(key_t, x)[i]) > 0) ++i; \
+ } \
+ ret = __kb_putp_aux_##name(b, __KB_PTR(b, x)[i], k); \
+ } \
+ return ret; \
+ } \
static inline key_t *kb_putp_##name(kbtree_##name##_t *b, key_t * __restrict k) \
- { \
+ { \
if (!b->root) { \
- b->root = (kbnode_t *)xcalloc(1, ILEN); \
- ++b->n_nodes; \
+ b->root = (kbnode_t *)xcalloc(1, ILEN); \
+ ++b->n_nodes; \
} \
- kbnode_t *r, *s; \
- ++b->n_keys; \
- r = b->root; \
- if (r->n == 2 * T - 1) { \
- ++b->n_nodes; \
- s = (kbnode_t *)xcalloc(1, ILEN); \
- b->root = s; s->is_internal = 1; s->n = 0; \
- __KB_PTR(b, s)[0] = r; \
- __kb_split_##name(b, s, 0, r); \
- r = s; \
- } \
- return __kb_putp_aux_##name(b, r, k); \
- } \
+ kbnode_t *r, *s; \
+ ++b->n_keys; \
+ r = b->root; \
+ if (r->n == 2 * T - 1) { \
+ ++b->n_nodes; \
+ s = (kbnode_t *)xcalloc(1, ILEN); \
+ b->root = s; s->is_internal = 1; s->n = 0; \
+ __KB_PTR(b, s)[0] = r; \
+ __kb_split_##name(b, s, 0, r); \
+ r = s; \
+ } \
+ return __kb_putp_aux_##name(b, r, k); \
+ } \
static inline void kb_put_##name(kbtree_##name##_t *b, key_t k) \
- { \
- kb_putp_##name(b, &k); \
+ { \
+ kb_putp_##name(b, &k); \
}
-#define __KB_DEL(name, key_t, kbnode_t, T) \
+#define __KB_DEL(name, key_t, kbnode_t, T) \
static inline key_t __kb_delp_aux_##name(kbtree_##name##_t *b, kbnode_t *x, key_t * __restrict k, \
int s) \
- { \
- int yn, zn, i, r = 0; \
- kbnode_t *xp, *y, *z; \
- key_t kp; \
- if (x == 0) return *k; \
- if (s) { /* s can only be 0, 1 or 2 */ \
- r = x->is_internal == 0? 0 : s == 1? 1 : -1; \
- i = s == 1? x->n - 1 : -1; \
- } else i = __kb_getp_aux_##name(x, k, &r); \
- if (x->is_internal == 0) { \
- if (s == 2) ++i; \
- kp = __KB_KEY(key_t, x)[i]; \
+ { \
+ int yn, zn, i, r = 0; \
+ kbnode_t *xp, *y, *z; \
+ key_t kp; \
+ if (x == 0) return *k; \
+ if (s) { /* s can only be 0, 1 or 2 */ \
+ r = x->is_internal == 0? 0 : s == 1? 1 : -1; \
+ i = s == 1? x->n - 1 : -1; \
+ } else i = __kb_getp_aux_##name(x, k, &r); \
+ if (x->is_internal == 0) { \
+ if (s == 2) ++i; \
+ kp = __KB_KEY(key_t, x)[i]; \
memmove(&__KB_KEY(key_t, x)[i], &__KB_KEY(key_t, \
x)[i + 1], \
(unsigned int)(x->n - i - 1) * sizeof(key_t)); \
- --x->n; \
- return kp; \
- } \
- if (r == 0) { \
- if ((yn = __KB_PTR(b, x)[i]->n) >= T) { \
- xp = __KB_PTR(b, x)[i]; \
- kp = __KB_KEY(key_t, x)[i]; \
+ --x->n; \
+ return kp; \
+ } \
+ if (r == 0) { \
+ if ((yn = __KB_PTR(b, x)[i]->n) >= T) { \
+ xp = __KB_PTR(b, x)[i]; \
+ kp = __KB_KEY(key_t, x)[i]; \
__KB_KEY(key_t, x)[i] = __kb_delp_aux_##name(b, xp, 0, 1); \
- return kp; \
- } else if ((zn = __KB_PTR(b, x)[i + 1]->n) >= T) { \
- xp = __KB_PTR(b, x)[i + 1]; \
- kp = __KB_KEY(key_t, x)[i]; \
+ return kp; \
+ } else if ((zn = __KB_PTR(b, x)[i + 1]->n) >= T) { \
+ xp = __KB_PTR(b, x)[i + 1]; \
+ kp = __KB_KEY(key_t, x)[i]; \
__KB_KEY(key_t, x)[i] = __kb_delp_aux_##name(b, xp, 0, 2); \
- return kp; \
- } else if (yn == T - 1 && zn == T - 1) { \
- y = __KB_PTR(b, x)[i]; z = __KB_PTR(b, x)[i + 1]; \
- __KB_KEY(key_t, y)[y->n++] = *k; \
+ return kp; \
+ } else if (yn == T - 1 && zn == T - 1) { \
+ y = __KB_PTR(b, x)[i]; z = __KB_PTR(b, x)[i + 1]; \
+ __KB_KEY(key_t, y)[y->n++] = *k; \
memmove(&__KB_KEY(key_t, y)[y->n], __KB_KEY(key_t, z), (unsigned int)z->n * sizeof(key_t)); \
if (y->is_internal) memmove(&__KB_PTR(b, y)[y->n], __KB_PTR(b, \
z), \
(unsigned int)(z->n + 1) * sizeof(void *)); \
- y->n += z->n; \
+ y->n += z->n; \
memmove(&__KB_KEY(key_t, x)[i], &__KB_KEY(key_t, \
x)[i + 1], \
(unsigned int)(x->n - i - 1) * sizeof(key_t)); \
memmove(&__KB_PTR(b, x)[i + 1], &__KB_PTR(b, \
x)[i + 2], \
(unsigned int)(x->n - i - 1) * sizeof(void *)); \
- --x->n; \
- XFREE_CLEAR(z); \
- return __kb_delp_aux_##name(b, y, k, s); \
- } \
- } \
- ++i; \
- if ((xp = __KB_PTR(b, x)[i])->n == T - 1) { \
- if (i > 0 && (y = __KB_PTR(b, x)[i - 1])->n >= T) { \
+ --x->n; \
+ XFREE_CLEAR(z); \
+ return __kb_delp_aux_##name(b, y, k, s); \
+ } \
+ } \
+ ++i; \
+ if ((xp = __KB_PTR(b, x)[i])->n == T - 1) { \
+ if (i > 0 && (y = __KB_PTR(b, x)[i - 1])->n >= T) { \
memmove(&__KB_KEY(key_t, xp)[1], __KB_KEY(key_t, xp), (unsigned int)xp->n * sizeof(key_t)); \
if (xp->is_internal) memmove(&__KB_PTR(b, xp)[1], __KB_PTR(b, \
xp), \
(unsigned int)(xp->n + 1) * sizeof(void *)); \
- __KB_KEY(key_t, xp)[0] = __KB_KEY(key_t, x)[i - 1]; \
+ __KB_KEY(key_t, xp)[0] = __KB_KEY(key_t, x)[i - 1]; \
__KB_KEY(key_t, x)[i - 1] = __KB_KEY(key_t, y)[y->n - 1]; \
if (xp->is_internal) __KB_PTR(b, xp)[0] = __KB_PTR(b, y)[y->n]; \
- --y->n; ++xp->n; \
+ --y->n; ++xp->n; \
} else if (i < x->n && (y = __KB_PTR(b, x)[i + 1])->n >= T) { \
- __KB_KEY(key_t, xp)[xp->n++] = __KB_KEY(key_t, x)[i]; \
- __KB_KEY(key_t, x)[i] = __KB_KEY(key_t, y)[0]; \
+ __KB_KEY(key_t, xp)[xp->n++] = __KB_KEY(key_t, x)[i]; \
+ __KB_KEY(key_t, x)[i] = __KB_KEY(key_t, y)[0]; \
if (xp->is_internal) __KB_PTR(b, xp)[xp->n] = __KB_PTR(b, y)[0]; \
- --y->n; \
+ --y->n; \
memmove(__KB_KEY(key_t, y), &__KB_KEY(key_t, y)[1], (unsigned int)y->n * sizeof(key_t)); \
if (y->is_internal) memmove(__KB_PTR(b, y), &__KB_PTR(b, \
y)[1], \
@@ -301,55 +299,55 @@
} else if (i > 0 && (y = __KB_PTR(b, x)[i - 1])->n == T - 1) { \
__KB_KEY(key_t, y)[y->n++] = __KB_KEY(key_t, x)[i - 1]; \
memmove(&__KB_KEY(key_t, y)[y->n], __KB_KEY(key_t, xp), \
- (unsigned int)xp->n * sizeof(key_t)); \
+ (unsigned int)xp->n * sizeof(key_t)); \
if (y->is_internal) memmove(&__KB_PTR(b, y)[y->n], __KB_PTR(b, \
xp), \
(unsigned int)(xp->n + 1) * sizeof(void *)); \
- y->n += xp->n; \
+ y->n += xp->n; \
memmove(&__KB_KEY(key_t, x)[i - 1], &__KB_KEY(key_t, \
x)[i], \
(unsigned int)(x->n - i) * sizeof(key_t)); \
memmove(&__KB_PTR(b, x)[i], &__KB_PTR(b, \
x)[i + 1], (unsigned int)(x->n - i) * sizeof(void *)); \
- --x->n; \
- XFREE_CLEAR(xp); \
- xp = y; \
+ --x->n; \
+ XFREE_CLEAR(xp); \
+ xp = y; \
} else if (i < x->n && (y = __KB_PTR(b, x)[i + 1])->n == T - 1) { \
- __KB_KEY(key_t, xp)[xp->n++] = __KB_KEY(key_t, x)[i]; \
+ __KB_KEY(key_t, xp)[xp->n++] = __KB_KEY(key_t, x)[i]; \
memmove(&__KB_KEY(key_t, xp)[xp->n], __KB_KEY(key_t, y), \
- (unsigned int)y->n * sizeof(key_t)); \
+ (unsigned int)y->n * sizeof(key_t)); \
if (xp->is_internal) memmove(&__KB_PTR(b, xp)[xp->n], __KB_PTR(b, y), \
(unsigned int)(y->n + 1) * sizeof(void *)); \
- xp->n += y->n; \
+ xp->n += y->n; \
memmove(&__KB_KEY(key_t, x)[i], &__KB_KEY(key_t, \
x)[i + 1], \
(unsigned int)(x->n - i - 1) * sizeof(key_t)); \
memmove(&__KB_PTR(b, x)[i + 1], &__KB_PTR(b, \
x)[i + 2], \
(unsigned int)(x->n - i - 1) * sizeof(void *)); \
- --x->n; \
- XFREE_CLEAR(y); \
- } \
- } \
- return __kb_delp_aux_##name(b, xp, k, s); \
- } \
+ --x->n; \
+ XFREE_CLEAR(y); \
+ } \
+ } \
+ return __kb_delp_aux_##name(b, xp, k, s); \
+ } \
static inline key_t kb_delp_##name(kbtree_##name##_t *b, key_t * __restrict k) \
- { \
- kbnode_t *x; \
- key_t ret; \
- ret = __kb_delp_aux_##name(b, b->root, k, 0); \
- --b->n_keys; \
- if (b->root->n == 0 && b->root->is_internal) { \
- --b->n_nodes; \
- x = b->root; \
- b->root = __KB_PTR(b, x)[0]; \
- XFREE_CLEAR(x); \
- } \
- return ret; \
- } \
+ { \
+ kbnode_t *x; \
+ key_t ret; \
+ ret = __kb_delp_aux_##name(b, b->root, k, 0); \
+ --b->n_keys; \
+ if (b->root->n == 0 && b->root->is_internal) { \
+ --b->n_nodes; \
+ x = b->root; \
+ b->root = __KB_PTR(b, x)[0]; \
+ XFREE_CLEAR(x); \
+ } \
+ return ret; \
+ } \
static inline key_t kb_del_##name(kbtree_##name##_t *b, key_t k) \
- { \
- return kb_delp_##name(b, &k); \
+ { \
+ return kb_delp_##name(b, &k); \
}
#define __KB_ITR(name, key_t, kbnode_t) \
@@ -425,7 +423,7 @@
return 0; \
} \
static inline int kb_itr_get_##name(kbtree_##name##_t *b, key_t k, kbitr_##name##_t *itr) \
- { \
+ { \
return kb_itr_getp_##name(b, &k, itr); \
} \
static inline void kb_del_itr_##name(kbtree_##name##_t *b, kbitr_##name##_t *itr) \
@@ -439,12 +437,12 @@
KBTREE_INIT_IMPL(name, key_t, kbnode_##name##_t, __cmp, T, \
(sizeof(kbnode_##name##_t)+(2*T)*sizeof(void *)))
-#define KBTREE_INIT_IMPL(name, key_t, kbnode_t, __cmp, T, ILEN) \
- __KB_TREE_T(name, key_t, T) \
- __KB_GET_AUX1(name, key_t, kbnode_t, __cmp) \
- __KB_GET(name, key_t, kbnode_t) \
- __KB_INTERVAL(name, key_t, kbnode_t) \
- __KB_PUT(name, key_t, kbnode_t, __cmp, T, ILEN) \
+#define KBTREE_INIT_IMPL(name, key_t, kbnode_t, __cmp, T, ILEN) \
+ __KB_TREE_T(name, key_t, T) \
+ __KB_GET_AUX1(name, key_t, kbnode_t, __cmp) \
+ __KB_GET(name, key_t, kbnode_t) \
+ __KB_INTERVAL(name, key_t, kbnode_t) \
+ __KB_PUT(name, key_t, kbnode_t, __cmp, T, ILEN) \
__KB_DEL(name, key_t, kbnode_t, T) \
__KB_ITR(name, key_t, kbnode_t)
diff --git a/src/nvim/lib/khash.h b/src/nvim/lib/khash.h
index dd87415144..e0faf94db9 100644
--- a/src/nvim/lib/khash.h
+++ b/src/nvim/lib/khash.h
@@ -417,12 +417,12 @@ typedef khint_t khiter_t;
} \
}
-#define KHASH_DECLARE(name, khkey_t, khval_t) \
- __KHASH_TYPE(name, khkey_t, khval_t) \
+#define KHASH_DECLARE(name, khkey_t, khval_t) \
+ __KHASH_TYPE(name, khkey_t, khval_t) \
__KHASH_PROTOTYPES(name, khkey_t, khval_t)
#define KHASH_INIT2(name, SCOPE, khkey_t, khval_t, kh_is_map, __hash_func, __hash_equal) \
- __KHASH_TYPE(name, khkey_t, khval_t) \
+ __KHASH_TYPE(name, khkey_t, khval_t) \
__KHASH_IMPL(name, SCOPE, khkey_t, khval_t, kh_is_map, __hash_func, __hash_equal)
#define KHASH_INIT(name, khkey_t, khval_t, kh_is_map, __hash_func, __hash_equal) \
@@ -627,12 +627,12 @@ static kh_inline khint_t __ac_Wang_hash(khint_t key)
@param vvar Variable to which value will be assigned
@param code Block of code to execute
*/
-#define kh_foreach(h, kvar, vvar, code) { khint_t __i; \
- for (__i = kh_begin(h); __i != kh_end(h); ++__i) { \
- if (!kh_exist(h, __i)) continue; \
- (kvar) = kh_key(h, __i); \
- (vvar) = kh_val(h, __i); \
- code; \
+#define kh_foreach(h, kvar, vvar, code) { khint_t __i; \
+ for (__i = kh_begin(h); __i != kh_end(h); ++__i) { \
+ if (!kh_exist(h, __i)) continue; \
+ (kvar) = kh_key(h, __i); \
+ (vvar) = kh_val(h, __i); \
+ code; \
} }
/*! @function
@@ -641,11 +641,11 @@ static kh_inline khint_t __ac_Wang_hash(khint_t key)
@param vvar Variable to which value will be assigned
@param code Block of code to execute
*/
-#define kh_foreach_value(h, vvar, code) { khint_t __i; \
- for (__i = kh_begin(h); __i != kh_end(h); ++__i) { \
- if (!kh_exist(h, __i)) continue; \
- (vvar) = kh_val(h, __i); \
- code; \
+#define kh_foreach_value(h, vvar, code) { khint_t __i; \
+ for (__i = kh_begin(h); __i != kh_end(h); ++__i) { \
+ if (!kh_exist(h, __i)) continue; \
+ (vvar) = kh_val(h, __i); \
+ code; \
} }
/*! @function
@@ -672,7 +672,7 @@ static kh_inline khint_t __ac_Wang_hash(khint_t key)
@abstract Instantiate a hash set containing integer keys
@param name Name of the hash table [symbol]
*/
-#define KHASH_SET_INIT_INT(name) \
+#define KHASH_SET_INIT_INT(name) \
KHASH_INIT(name, khint32_t, char, 0, kh_int_hash_func, kh_int_hash_equal)
/*! @function
@@ -680,14 +680,14 @@ static kh_inline khint_t __ac_Wang_hash(khint_t key)
@param name Name of the hash table [symbol]
@param khval_t Type of values [type]
*/
-#define KHASH_MAP_INIT_INT(name, khval_t) \
+#define KHASH_MAP_INIT_INT(name, khval_t) \
KHASH_INIT(name, khint32_t, khval_t, 1, kh_int_hash_func, kh_int_hash_equal)
/*! @function
@abstract Instantiate a hash map containing 64-bit integer keys
@param name Name of the hash table [symbol]
*/
-#define KHASH_SET_INIT_INT64(name) \
+#define KHASH_SET_INIT_INT64(name) \
KHASH_INIT(name, khint64_t, char, 0, kh_int64_hash_func, kh_int64_hash_equal)
/*! @function
@@ -695,7 +695,7 @@ static kh_inline khint_t __ac_Wang_hash(khint_t key)
@param name Name of the hash table [symbol]
@param khval_t Type of values [type]
*/
-#define KHASH_MAP_INIT_INT64(name, khval_t) \
+#define KHASH_MAP_INIT_INT64(name, khval_t) \
KHASH_INIT(name, khint64_t, khval_t, 1, kh_int64_hash_func, kh_int64_hash_equal)
typedef const char *kh_cstr_t;
@@ -703,7 +703,7 @@ typedef const char *kh_cstr_t;
@abstract Instantiate a hash map containing const char* keys
@param name Name of the hash table [symbol]
*/
-#define KHASH_SET_INIT_STR(name) \
+#define KHASH_SET_INIT_STR(name) \
KHASH_INIT(name, kh_cstr_t, char, 0, kh_str_hash_func, kh_str_hash_equal)
/*! @function
diff --git a/src/nvim/lib/ringbuf.h b/src/nvim/lib/ringbuf.h
index 06f7830bd1..4fd110a531 100644
--- a/src/nvim/lib/ringbuf.h
+++ b/src/nvim/lib/ringbuf.h
@@ -29,7 +29,7 @@
: ((rb)->next > \
(rb)->first) ? (size_t)((rb)->next - \
(rb)->first) \
- : (size_t)((rb)->\
+ : (size_t)((rb)-> \
next - (rb)->buf + \
(rb)->buf_end - \
(rb)->first + 1))
@@ -130,7 +130,6 @@
.buf_end = buf + size - 1, \
}; \
} \
-\
static inline void funcprefix##_rb_free(TypeName##RingBuffer *const rb) \
REAL_FATTR_UNUSED; \
static inline void funcprefix##_rb_free(TypeName##RingBuffer *const rb) \
@@ -143,14 +142,12 @@
} \
XFREE_CLEAR(rb->buf); \
} \
-\
static inline void funcprefix##_rb_dealloc(TypeName##RingBuffer *const rb) \
REAL_FATTR_UNUSED; \
static inline void funcprefix##_rb_dealloc(TypeName##RingBuffer *const rb) \
{ \
XFREE_CLEAR(rb->buf); \
} \
-\
static inline void funcprefix##_rb_push(TypeName##RingBuffer *const rb, \
RBType item) \
REAL_FATTR_NONNULL_ARG(1); \
@@ -166,7 +163,6 @@
*rb->next = item; \
rb->next = _RINGBUF_NEXT(rb, rb->next); \
} \
-\
static inline ptrdiff_t funcprefix##_rb_find_idx(const TypeName##RingBuffer *const rb, \
const RBType *const item_p) \
REAL_FATTR_NONNULL_ALL REAL_FATTR_PURE REAL_FATTR_UNUSED; \
@@ -183,21 +179,18 @@
return item_p - rb->buf + rb->buf_end - rb->first + 1; \
} \
} \
-\
static inline size_t funcprefix##_rb_size(const TypeName##RingBuffer *const rb) \
REAL_FATTR_NONNULL_ALL REAL_FATTR_PURE; \
static inline size_t funcprefix##_rb_size(const TypeName##RingBuffer *const rb) \
{ \
return (size_t)(rb->buf_end - rb->buf) + 1; \
} \
-\
static inline size_t funcprefix##_rb_length(const TypeName##RingBuffer *const rb) \
REAL_FATTR_NONNULL_ALL REAL_FATTR_PURE; \
static inline size_t funcprefix##_rb_length(const TypeName##RingBuffer *const rb) \
{ \
return _RINGBUF_LENGTH(rb); \
} \
-\
static inline RBType *funcprefix##_rb_idx_p(const TypeName##RingBuffer *const rb, \
const size_t idx) \
REAL_FATTR_NONNULL_ALL REAL_FATTR_PURE; \
@@ -212,7 +205,6 @@
return rb->first + idx; \
} \
} \
-\
static inline RBType funcprefix##_rb_idx(const TypeName##RingBuffer *const rb, \
const size_t idx) \
REAL_FATTR_NONNULL_ALL REAL_FATTR_PURE REAL_FATTR_UNUSED; \
@@ -221,7 +213,6 @@
{ \
return *funcprefix##_rb_idx_p(rb, idx); \
} \
-\
static inline void funcprefix##_rb_insert(TypeName##RingBuffer *const rb, \
const size_t idx, \
RBType item) \
@@ -263,7 +254,6 @@
} \
rb->next = _RINGBUF_NEXT(rb, rb->next); \
} \
-\
static inline void funcprefix##_rb_remove(TypeName##RingBuffer *const rb, \
const size_t idx) \
REAL_FATTR_NONNULL_ARG(1) REAL_FATTR_UNUSED; \
diff --git a/src/nvim/macros.h b/src/nvim/macros.h
index 50ee91dc36..fd23ab8270 100644
--- a/src/nvim/macros.h
+++ b/src/nvim/macros.h
@@ -204,11 +204,11 @@
///
#if defined(__clang__) && __clang__ == 1
# define PRAGMA_DIAG_PUSH_IGNORE_MISSING_PROTOTYPES \
- _Pragma("clang diagnostic push")\
+ _Pragma("clang diagnostic push") \
_Pragma("clang diagnostic ignored \"-Wmissing-prototypes\"")
# ifdef HAVE_WIMPLICIT_FALLTHROUGH_FLAG
# define PRAGMA_DIAG_PUSH_IGNORE_IMPLICIT_FALLTHROUGH \
- _Pragma("clang diagnostic push")\
+ _Pragma("clang diagnostic push") \
_Pragma("clang diagnostic ignored \"-Wimplicit-fallthrough\"")
# else
# define PRAGMA_DIAG_PUSH_IGNORE_IMPLICIT_FALLTHROUGH \
@@ -218,11 +218,11 @@
_Pragma("clang diagnostic pop")
#elif defined(__GNUC__)
# define PRAGMA_DIAG_PUSH_IGNORE_MISSING_PROTOTYPES \
- _Pragma("GCC diagnostic push")\
+ _Pragma("GCC diagnostic push") \
_Pragma("GCC diagnostic ignored \"-Wmissing-prototypes\"")
# ifdef HAVE_WIMPLICIT_FALLTHROUGH_FLAG
# define PRAGMA_DIAG_PUSH_IGNORE_IMPLICIT_FALLTHROUGH \
- _Pragma("GCC diagnostic push")\
+ _Pragma("GCC diagnostic push") \
_Pragma("GCC diagnostic ignored \"-Wimplicit-fallthrough\"")
# else
# define PRAGMA_DIAG_PUSH_IGNORE_IMPLICIT_FALLTHROUGH \
diff --git a/src/nvim/map.c b/src/nvim/map.c
index 20d5570e8c..1d9abe3ef2 100644
--- a/src/nvim/map.c
+++ b/src/nvim/map.c
@@ -51,36 +51,28 @@
#define MAP_IMPL(T, U, ...) \
INITIALIZER_DECLARE(T, U, __VA_ARGS__); \
__KHASH_IMPL(T##_##U##_map, , T, U, 1, T##_hash, T##_eq) \
- \
void map_##T##_##U##_destroy(Map(T, U) *map) \
{ \
kh_dealloc(T##_##U##_map, &map->table); \
} \
- \
U map_##T##_##U##_get(Map(T, U) *map, T key) \
{ \
khiter_t k; \
- \
if ((k = kh_get(T##_##U##_map, &map->table, key)) == kh_end(&map->table)) { \
return INITIALIZER(T, U); \
} \
- \
return kh_val(&map->table, k); \
} \
- \
bool map_##T##_##U##_has(Map(T, U) *map, T key) \
{ \
return kh_get(T##_##U##_map, &map->table, key) != kh_end(&map->table); \
} \
- \
T map_##T##_##U##_key(Map(T, U) *map, T key) \
{ \
khiter_t k; \
- \
if ((k = kh_get(T##_##U##_map, &map->table, key)) == kh_end(&map->table)) { \
abort(); /* Caller must check map_has(). */ \
} \
- \
return kh_key(&map->table, k); \
} \
U map_##T##_##U##_put(Map(T, U) *map, T key, U value) \
@@ -88,15 +80,12 @@
int ret; \
U rv = INITIALIZER(T, U); \
khiter_t k = kh_put(T##_##U##_map, &map->table, key, &ret); \
- \
if (!ret) { \
rv = kh_val(&map->table, k); \
} \
- \
kh_val(&map->table, k) = value; \
return rv; \
} \
- \
U *map_##T##_##U##_ref(Map(T, U) *map, T key, bool put) \
{ \
int ret; \
@@ -112,23 +101,18 @@
return NULL; \
} \
} \
- \
return &kh_val(&map->table, k); \
} \
- \
U map_##T##_##U##_del(Map(T, U) *map, T key) \
{ \
U rv = INITIALIZER(T, U); \
khiter_t k; \
- \
if ((k = kh_get(T##_##U##_map, &map->table, key)) != kh_end(&map->table)) { \
rv = kh_val(&map->table, k); \
kh_del(T##_##U##_map, &map->table, k); \
} \
- \
return rv; \
} \
- \
void map_##T##_##U##_clear(Map(T, U) *map) \
{ \
kh_clear(T##_##U##_map, &map->table); \
diff --git a/src/nvim/map.h b/src/nvim/map.h
index 6ed341ac76..dbd85a4e1f 100644
--- a/src/nvim/map.h
+++ b/src/nvim/map.h
@@ -16,11 +16,9 @@
#define MAP_DECLS(T, U) \
KHASH_DECLARE(T##_##U##_map, T, U) \
- \
typedef struct { \
khash_t(T##_##U##_map) table; \
} Map(T, U); \
- \
Map(T, U) *map_##T##_##U##_new(void); \
void map_##T##_##U##_free(Map(T, U) *map); \
void map_##T##_##U##_destroy(Map(T, U) *map); \
diff --git a/src/nvim/memline.c b/src/nvim/memline.c
index b4e9869b17..7b57a68033 100644
--- a/src/nvim/memline.c
+++ b/src/nvim/memline.c
@@ -235,7 +235,7 @@ static linenr_T lowest_marked = 0;
// argument for ml_upd_block0()
typedef enum {
UB_FNAME = 0, // update timestamp and filename
- UB_SAME_DIR // update the B0_SAME_DIR flag
+ UB_SAME_DIR, // update the B0_SAME_DIR flag
} upd_block0_T;
#ifdef INCLUDE_GENERATED_DECLARATIONS
diff --git a/src/nvim/message.c b/src/nvim/message.c
index 75f0dd6bb7..aa0618a6d9 100644
--- a/src/nvim/message.c
+++ b/src/nvim/message.c
@@ -2408,7 +2408,7 @@ typedef enum {
SB_CLEAR_NONE = 0,
SB_CLEAR_ALL,
SB_CLEAR_CMDLINE_BUSY,
- SB_CLEAR_CMDLINE_DONE
+ SB_CLEAR_CMDLINE_DONE,
} sb_clear_T;
// When to clear text on next msg.
diff --git a/src/nvim/normal.h b/src/nvim/normal.h
index fbcc6da75b..0c2b8b4d8a 100644
--- a/src/nvim/normal.h
+++ b/src/nvim/normal.h
@@ -19,7 +19,7 @@ typedef enum {
kMTCharWise = 0, ///< character-wise movement/register
kMTLineWise = 1, ///< line-wise movement/register
kMTBlockWise = 2, ///< block-wise movement/register
- kMTUnknown = -1 ///< Unknown or invalid motion type
+ kMTUnknown = -1, ///< Unknown or invalid motion type
} MotionType;
/*
diff --git a/src/nvim/ops.h b/src/nvim/ops.h
index 11049b72c0..efde7290cf 100644
--- a/src/nvim/ops.h
+++ b/src/nvim/ops.h
@@ -77,7 +77,7 @@ typedef int (*Indenter)(void);
enum GRegFlags {
kGRegNoExpr = 1, ///< Do not allow expression register.
kGRegExprSrc = 2, ///< Return expression itself for "=" register.
- kGRegList = 4 ///< Return list.
+ kGRegList = 4, ///< Return list.
};
/// Definition of one register
diff --git a/src/nvim/option.c b/src/nvim/option.c
index 05dcf737b2..06b7c75245 100644
--- a/src/nvim/option.c
+++ b/src/nvim/option.c
@@ -105,7 +105,7 @@
// WV_ and BV_ values get typecasted to this for the "indir" field
typedef enum {
PV_NONE = 0,
- PV_MAXVAL = 0xffff // to avoid warnings for value out of range
+ PV_MAXVAL = 0xffff, // to avoid warnings for value out of range
} idopt_T;
/*
diff --git a/src/nvim/option_defs.h b/src/nvim/option_defs.h
index 441d29cd9f..6edc15be57 100644
--- a/src/nvim/option_defs.h
+++ b/src/nvim/option_defs.h
@@ -836,7 +836,7 @@ enum {
BV_WM,
BV_VSTS,
BV_VTS,
- BV_COUNT // must be the last one
+ BV_COUNT, // must be the last one
};
/*
@@ -889,7 +889,7 @@ enum {
WV_FCS,
WV_LCS,
WV_WINBL,
- WV_COUNT // must be the last one
+ WV_COUNT, // must be the last one
};
// Value for b_p_ul indicating the global value must be used.
diff --git a/src/nvim/os/fileio.h b/src/nvim/os/fileio.h
index 7c53cd4f07..426dc422c2 100644
--- a/src/nvim/os/fileio.h
+++ b/src/nvim/os/fileio.h
@@ -68,7 +68,7 @@ enum {
/// Read or write buffer size
///
/// Currently equal to (IOSIZE - 1), but they do not need to be connected.
- kRWBufferSize = 1024
+ kRWBufferSize = 1024,
};
#ifdef INCLUDE_GENERATED_DECLARATIONS
diff --git a/src/nvim/os/input.c b/src/nvim/os/input.c
index 4c6e9ee4d3..5a096393d3 100644
--- a/src/nvim/os/input.c
+++ b/src/nvim/os/input.c
@@ -30,7 +30,7 @@
typedef enum {
kInputNone,
kInputAvail,
- kInputEof
+ kInputEof,
} InbufPollResult;
static Stream read_stream = { .closed = true }; // Input before UI starts.
diff --git a/src/nvim/os/pty_process_win.h b/src/nvim/os/pty_process_win.h
index 3f6cc58e3e..d1737fd63a 100644
--- a/src/nvim/os/pty_process_win.h
+++ b/src/nvim/os/pty_process_win.h
@@ -10,7 +10,7 @@
typedef enum {
kWinpty,
- kConpty
+ kConpty,
} PtyType;
typedef struct pty_process {
diff --git a/src/nvim/path.h b/src/nvim/path.h
index 5d81e68caa..1006ef9ffb 100644
--- a/src/nvim/path.h
+++ b/src/nvim/path.h
@@ -33,7 +33,7 @@ typedef enum file_comparison {
kDifferentFiles = 2, ///< Both exist and are different files.
kBothFilesMissing = 4, ///< Both don't exist.
kOneFileMissing = 6, ///< One of them doesn't exist.
- kEqualFileNames = 7 ///< Both don't exist and file names are same.
+ kEqualFileNames = 7, ///< Both don't exist and file names are same.
} FileComparison;
#ifdef INCLUDE_GENERATED_DECLARATIONS
diff --git a/src/nvim/pos.h b/src/nvim/pos.h
index 2fbd049aa0..d17e27906e 100644
--- a/src/nvim/pos.h
+++ b/src/nvim/pos.h
@@ -14,13 +14,13 @@ typedef int colnr_T;
#define PRIdCOLNR "d"
/// Maximal (invalid) line number
-enum { MAXLNUM = 0x7fffffff };
+enum { MAXLNUM = 0x7fffffff, };
/// Maximal column number
-enum { MAXCOL = INT_MAX };
+enum { MAXCOL = INT_MAX, };
// Minimum line number
-enum { MINLNUM = 1 };
+enum { MINLNUM = 1, };
// minimum column number
-enum { MINCOL = 1 };
+enum { MINCOL = 1, };
/*
* position in file or buffer
diff --git a/src/nvim/quickfix.c b/src/nvim/quickfix.c
index 570bb5e7ae..57c417c9c4 100644
--- a/src/nvim/quickfix.c
+++ b/src/nvim/quickfix.c
@@ -82,7 +82,7 @@ typedef enum
{
QFLT_QUICKFIX, ///< Quickfix list - global list
QFLT_LOCATION, ///< Location list - per window list
- QFLT_INTERNAL ///< Internal - Temporary list used by
+ QFLT_INTERNAL, ///< Internal - Temporary list used by
// getqflist()/getloclist()
} qfltype_T;
diff --git a/src/nvim/spell_defs.h b/src/nvim/spell_defs.h
index 78aa6bf199..220f51cd2f 100644
--- a/src/nvim/spell_defs.h
+++ b/src/nvim/spell_defs.h
@@ -230,7 +230,7 @@ typedef enum {
STATE_REP_INI, // Prepare for using REP items.
STATE_REP, // Use matching REP items from the .aff file.
STATE_REP_UNDO, // Undo a REP item replacement.
- STATE_FINAL // End of this node.
+ STATE_FINAL, // End of this node.
} state_T;
// Struct to keep the state at each level in suggest_try_change().
diff --git a/src/nvim/syntax.c b/src/nvim/syntax.c
index b194620b53..a82fd42976 100644
--- a/src/nvim/syntax.c
+++ b/src/nvim/syntax.c
@@ -5770,7 +5770,7 @@ static enum {
EXP_SUBCMD, // expand ":syn" sub-commands
EXP_CASE, // expand ":syn case" arguments
EXP_SPELL, // expand ":syn spell" arguments
- EXP_SYNC // expand ":syn sync" arguments
+ EXP_SYNC, // expand ":syn sync" arguments
} expand_what;
/*
diff --git a/src/nvim/tag.c b/src/nvim/tag.c
index 94f51c3b24..13cf1c376f 100644
--- a/src/nvim/tag.c
+++ b/src/nvim/tag.c
@@ -1404,7 +1404,7 @@ int find_tags(char_u *pat, int *num_matches, char_u ***matchesp, int flags, int
TS_LINEAR, // linear searching forward, till EOF
TS_BINARY, // binary searching
TS_SKIP_BACK, // skipping backwards
- TS_STEP_FORWARD // stepping forwards
+ TS_STEP_FORWARD, // stepping forwards
} state; // Current search state
int cmplen;
diff --git a/src/nvim/tui/tui.c b/src/nvim/tui/tui.c
index fcfe862044..f9c5521bdb 100644
--- a/src/nvim/tui/tui.c
+++ b/src/nvim/tui/tui.c
@@ -1484,7 +1484,6 @@ static void unibi_goto(UI *ui, int row, int col)
if (str) { \
unibi_var_t vars[26 + 26]; \
size_t orig_pos = data->bufpos; \
- \
memset(&vars, 0, sizeof(vars)); \
data->cork = true; \
retry: \
diff --git a/src/nvim/version.c b/src/nvim/version.c
index 9e2358c9a3..142c46b303 100644
--- a/src/nvim/version.c
+++ b/src/nvim/version.c
@@ -29,8 +29,8 @@
// for ":version", ":intro", and "nvim --version"
#ifndef NVIM_VERSION_MEDIUM
-# define NVIM_VERSION_MEDIUM "v" STR(NVIM_VERSION_MAJOR)\
- "." STR(NVIM_VERSION_MINOR) "." STR(NVIM_VERSION_PATCH)\
+# define NVIM_VERSION_MEDIUM "v" STR(NVIM_VERSION_MAJOR) \
+ "." STR(NVIM_VERSION_MINOR) "." STR(NVIM_VERSION_PATCH) \
NVIM_VERSION_PRERELEASE
#endif
#define NVIM_VERSION_LONG "NVIM " NVIM_VERSION_MEDIUM
diff --git a/src/nvim/vim.h b/src/nvim/vim.h
index 7d49ca6ff1..3dba0a769d 100644
--- a/src/nvim/vim.h
+++ b/src/nvim/vim.h
@@ -24,7 +24,7 @@
#include "nvim/os/os_defs.h" // bring lots of system header files
/// length of a buffer to store a number in ASCII (64 bits binary + NUL)
-enum { NUMBUFLEN = 65 };
+enum { NUMBUFLEN = 65, };
#define MAX_TYPENR 65535
@@ -199,7 +199,7 @@ enum {
#define DIALOG_MSG_SIZE 1000 // buffer size for dialog_msg()
-enum { FOLD_TEXT_LEN = 51 }; //!< buffer size for get_foldtext()
+enum { FOLD_TEXT_LEN = 51, }; //!< buffer size for get_foldtext()
// Maximum length of key sequence to be mapped.
diff --git a/src/nvim/viml/parser/expressions.c b/src/nvim/viml/parser/expressions.c
index 39687a8e8d..4f028fa87f 100644
--- a/src/nvim/viml/parser/expressions.c
+++ b/src/nvim/viml/parser/expressions.c
@@ -1525,7 +1525,6 @@ static inline void east_set_error(const ParserState *const pstate, ExprASTError
assert(want_node == kENodeOperator); \
/* Operator: may only be curly braces name, but only under certain */ \
/* conditions. */ \
-\
/* First condition is that there is no space before a part of complex */ \
/* identifier. */ \
if (prev_token.type == kExprLexSpacing) { \
@@ -1534,7 +1533,6 @@ static inline void east_set_error(const ParserState *const pstate, ExprASTError
switch ((*top_node_p)->type) { \
/* Second is that previous node is one of the identifiers: */ \
/* complex, plain, curly braces. */ \
-\
/* TODO(ZyX-I): Extend syntax to allow ${expr}. This is needed to */ \
/* handle environment variables like those bash uses for */ \
/* `export -f`: their names consist not only of alphanumeric */ \
diff --git a/src/uncrustify.cfg b/src/uncrustify.cfg
index 13d1f472ed..c773b3e0ab 100644
--- a/src/uncrustify.cfg
+++ b/src/uncrustify.cfg
@@ -803,7 +803,7 @@ sp_incdec = remove # ignore/add/remove/force/not_defined
# Add or remove space before a backslash-newline at the end of a line.
#
# Default: add
-sp_before_nl_cont = ignore # ignore/add/remove/force/not_defined
+sp_before_nl_cont = force # ignore/add/remove/force/not_defined
# (OC) Add or remove space after the scope '+' or '-', as in '-(void) foo;'
# or '+(int) bar;'.
@@ -3022,7 +3022,7 @@ mod_case_brace = remove # ignore/add/remove/force/not_defined
mod_remove_empty_return = false # true/false
# Add or remove the comma after the last value of an enumeration.
-mod_enum_last_comma = ignore # ignore/add/remove/force/not_defined
+mod_enum_last_comma = add # ignore/add/remove/force/not_defined
# (OC) Whether to organize the properties. If true, properties will be
# rearranged according to the mod_sort_oc_property_*_weight factors.
@@ -3307,5 +3307,5 @@ set QUESTION REAL_FATTR_CONST
set QUESTION REAL_FATTR_NONNULL_ALL
set QUESTION REAL_FATTR_PURE
set QUESTION REAL_FATTR_WARN_UNUSED_RESULT
-# option(s) with 'not default' value: 66
+# option(s) with 'not default' value: 67
#