mirror of
https://github.com/neovim/neovim.git
synced 2025-10-02 16:08:36 +00:00
Refactor/uncrustify (#15790)
* refactor: format with uncrustify * fixup(dundar): fix functions comments * fixup(dundar): remove space between variable and ++/-- * fixup(dundar): better workaround for macro attributes This is done to be able to better use uncrustify rules for macros * fixup(justin): make preprocessors follow neovim style guide
This commit is contained in:
@@ -33,8 +33,8 @@
|
||||
#include "nvim/vim.h"
|
||||
|
||||
#if MIN_LOG_LEVEL > DEBUG_LOG_LEVEL
|
||||
#define log_client_msg(...)
|
||||
#define log_server_msg(...)
|
||||
# define log_client_msg(...)
|
||||
# define log_server_msg(...)
|
||||
#endif
|
||||
|
||||
static PMap(cstr_t) event_strings = MAP_INIT;
|
||||
@@ -699,14 +699,14 @@ const char *rpc_client_name(Channel *chan)
|
||||
}
|
||||
|
||||
#if MIN_LOG_LEVEL <= DEBUG_LOG_LEVEL
|
||||
#define REQ "[request] "
|
||||
#define RES "[response] "
|
||||
#define NOT "[notify] "
|
||||
#define ERR "[error] "
|
||||
# define REQ "[request] "
|
||||
# define RES "[response] "
|
||||
# define NOT "[notify] "
|
||||
# define ERR "[error] "
|
||||
|
||||
// Cannot define array with negative offsets, so this one is needed to be added
|
||||
// to MSGPACK_UNPACK_\* values.
|
||||
#define MUR_OFF 2
|
||||
# define MUR_OFF 2
|
||||
|
||||
static const char *const msgpack_error_messages[] = {
|
||||
[MSGPACK_UNPACK_EXTRA_BYTES + MUR_OFF] = "extra bytes found",
|
||||
|
@@ -47,17 +47,15 @@ static msgpack_sbuffer sbuffer;
|
||||
} \
|
||||
\
|
||||
static void msgpack_rpc_from_##lt(Integer o, msgpack_packer *res) \
|
||||
/* uncrustify:indent-off */ \
|
||||
FUNC_ATTR_NONNULL_ARG(2) \
|
||||
/* uncrustify:indent-on */ \
|
||||
{ \
|
||||
msgpack_packer pac; \
|
||||
msgpack_packer_init(&pac, &sbuffer, msgpack_sbuffer_write); \
|
||||
msgpack_pack_int64(&pac, (handle_T)o); \
|
||||
msgpack_pack_ext(res, sbuffer.size, \
|
||||
kObjectType##t - EXT_OBJECT_TYPE_SHIFT); \
|
||||
msgpack_pack_ext_body(res, sbuffer.data, sbuffer.size); \
|
||||
msgpack_sbuffer_clear(&sbuffer); \
|
||||
msgpack_packer pac; \
|
||||
msgpack_packer_init(&pac, &sbuffer, msgpack_sbuffer_write); \
|
||||
msgpack_pack_int64(&pac, (handle_T)o); \
|
||||
msgpack_pack_ext(res, sbuffer.size, \
|
||||
kObjectType##t - EXT_OBJECT_TYPE_SHIFT); \
|
||||
msgpack_pack_ext_body(res, sbuffer.data, sbuffer.size); \
|
||||
msgpack_sbuffer_clear(&sbuffer); \
|
||||
}
|
||||
|
||||
void msgpack_rpc_helpers_init(void)
|
||||
@@ -90,11 +88,11 @@ bool msgpack_rpc_to_object(const msgpack_object *const obj, Object *const arg)
|
||||
kvec_withinit_t(MPToAPIObjectStackItem, 2) stack = KV_INITIAL_VALUE;
|
||||
kvi_init(stack);
|
||||
kvi_push(stack, ((MPToAPIObjectStackItem) {
|
||||
.mobj = obj,
|
||||
.aobj = arg,
|
||||
.container = false,
|
||||
.idx = 0,
|
||||
}));
|
||||
.mobj = obj,
|
||||
.aobj = arg,
|
||||
.container = false,
|
||||
.idx = 0,
|
||||
}));
|
||||
while (ret && kv_size(stack)) {
|
||||
MPToAPIObjectStackItem cur = kv_last(stack);
|
||||
if (!cur.container) {
|
||||
@@ -154,19 +152,19 @@ case type: { \
|
||||
cur.idx++;
|
||||
kv_last(stack) = cur;
|
||||
kvi_push(stack, ((MPToAPIObjectStackItem) {
|
||||
.mobj = &cur.mobj->via.array.ptr[idx],
|
||||
.aobj = &cur.aobj->data.array.items[idx],
|
||||
.container = false,
|
||||
}));
|
||||
.mobj = &cur.mobj->via.array.ptr[idx],
|
||||
.aobj = &cur.aobj->data.array.items[idx],
|
||||
.container = false,
|
||||
}));
|
||||
}
|
||||
} else {
|
||||
*cur.aobj = ARRAY_OBJ(((Array) {
|
||||
.size = size,
|
||||
.capacity = size,
|
||||
.items = (size > 0
|
||||
.size = size,
|
||||
.capacity = size,
|
||||
.items = (size > 0
|
||||
? xcalloc(size, sizeof(*cur.aobj->data.array.items))
|
||||
: NULL),
|
||||
}));
|
||||
}));
|
||||
cur.container = true;
|
||||
kv_last(stack) = cur;
|
||||
}
|
||||
@@ -207,20 +205,20 @@ case type: { \
|
||||
}
|
||||
if (ret) {
|
||||
kvi_push(stack, ((MPToAPIObjectStackItem) {
|
||||
.mobj = &cur.mobj->via.map.ptr[idx].val,
|
||||
.aobj = &cur.aobj->data.dictionary.items[idx].value,
|
||||
.container = false,
|
||||
}));
|
||||
.mobj = &cur.mobj->via.map.ptr[idx].val,
|
||||
.aobj = &cur.aobj->data.dictionary.items[idx].value,
|
||||
.container = false,
|
||||
}));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
*cur.aobj = DICTIONARY_OBJ(((Dictionary) {
|
||||
.size = size,
|
||||
.capacity = size,
|
||||
.items = (size > 0
|
||||
.size = size,
|
||||
.capacity = size,
|
||||
.items = (size > 0
|
||||
? xcalloc(size, sizeof(*cur.aobj->data.dictionary.items))
|
||||
: NULL),
|
||||
}));
|
||||
}));
|
||||
cur.container = true;
|
||||
kv_last(stack) = cur;
|
||||
}
|
||||
@@ -412,9 +410,9 @@ void msgpack_rpc_from_object(const Object result, msgpack_packer *const res)
|
||||
cur.idx++;
|
||||
kv_last(stack) = cur;
|
||||
kvi_push(stack, ((APIToMPObjectStackItem) {
|
||||
.aobj = &cur.aobj->data.array.items[idx],
|
||||
.container = false,
|
||||
}));
|
||||
.aobj = &cur.aobj->data.array.items[idx],
|
||||
.container = false,
|
||||
}));
|
||||
}
|
||||
} else {
|
||||
msgpack_pack_array(res, size);
|
||||
@@ -435,9 +433,9 @@ void msgpack_rpc_from_object(const Object result, msgpack_packer *const res)
|
||||
msgpack_rpc_from_string(cur.aobj->data.dictionary.items[idx].key,
|
||||
res);
|
||||
kvi_push(stack, ((APIToMPObjectStackItem) {
|
||||
.aobj = &cur.aobj->data.dictionary.items[idx].value,
|
||||
.container = false,
|
||||
}));
|
||||
.aobj = &cur.aobj->data.dictionary.items[idx].value,
|
||||
.container = false,
|
||||
}));
|
||||
}
|
||||
} else {
|
||||
msgpack_pack_map(res, size);
|
||||
|
Reference in New Issue
Block a user