refactor(style): switch-case formatting, "uncrustify:indent-off" #15669

* refactor: disable formatting for attribute in macro
* fixup: disable/enable uncrustify with uncrustify:indent-off/on
* fixup: stop indenting contents inside braces in case
* fixup: remove case brace if no variable declaration
This commit is contained in:
dundargoc
2021-09-17 16:38:16 +02:00
committed by GitHub
parent 1ec3d37192
commit 867e888599
9 changed files with 726 additions and 778 deletions

View File

@@ -44,12 +44,12 @@ disable_processing_nl_cont = false # true/false
# file. # file.
# #
# Default: *INDENT-OFF* # Default: *INDENT-OFF*
disable_processing_cmt = " *INDENT-OFF*" # string disable_processing_cmt = "uncrustify:indent-off" # string
# Specify the marker used in comments to (re)enable processing in a file. # Specify the marker used in comments to (re)enable processing in a file.
# #
# Default: *INDENT-ON* # Default: *INDENT-ON*
enable_processing_cmt = " *INDENT-ON*" # string enable_processing_cmt = "uncrustify:indent-on" # string
# Enable parsing of digraphs. # Enable parsing of digraphs.
enable_digraphs = false # true/false enable_digraphs = false # true/false
@@ -1194,7 +1194,7 @@ indent_switch_case = 0 # unsigned number
# Spaces to indent '{' from 'case'. By default, the brace will appear under # Spaces to indent '{' from 'case'. By default, the brace will appear under
# the 'c' in case. Usually set to 0 or indent_columns. Negative values are OK. # the 'c' in case. Usually set to 0 or indent_columns. Negative values are OK.
# It might wise to choose the same value for the option indent_switch_case. # It might wise to choose the same value for the option indent_switch_case.
indent_case_brace = 2 # number indent_case_brace = 0 # number
# indent 'break' with 'case' from 'switch'. # indent 'break' with 'case' from 'switch'.
indent_switch_break_with_case = false # true/false indent_switch_break_with_case = false # true/false
@@ -2987,7 +2987,7 @@ mod_move_case_break = false # true/false
# Add or remove braces around a fully braced case statement. Will only remove # Add or remove braces around a fully braced case statement. Will only remove
# braces if there are no variable declarations in the block. # braces if there are no variable declarations in the block.
mod_case_brace = ignore # ignore/add/remove/force/not_defined mod_case_brace = remove # ignore/add/remove/force/not_defined
# Whether to remove a void 'return;' that appears as the last statement in a # Whether to remove a void 'return;' that appears as the last statement in a
# function. # function.
@@ -3279,5 +3279,5 @@ set PREPROC REAL_FATTR_CONST
set PREPROC REAL_FATTR_NONNULL_ALL set PREPROC REAL_FATTR_NONNULL_ALL
set PREPROC REAL_FATTR_PURE set PREPROC REAL_FATTR_PURE
set PREPROC REAL_FATTR_WARN_UNUSED_RESULT set PREPROC REAL_FATTR_WARN_UNUSED_RESULT
# option(s) with 'not default' value: 59 # option(s) with 'not default' value: 61
# #

View File

@@ -1,37 +1,36 @@
// This is an open source non-commercial project. Dear PVS-Studio, please check // This is an open source non-commercial project. Dear PVS-Studio, please check
// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com // it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
#include <inttypes.h>
#include <msgpack.h>
#include <stdbool.h> #include <stdbool.h>
#include <string.h> #include <string.h>
#include <inttypes.h>
#include <uv.h> #include <uv.h>
#include <msgpack.h>
#include "nvim/api/private/helpers.h" #include "nvim/api/private/helpers.h"
#include "nvim/api/vim.h"
#include "nvim/api/ui.h" #include "nvim/api/ui.h"
#include "nvim/channel.h" #include "nvim/api/vim.h"
#include "nvim/msgpack_rpc/channel.h"
#include "nvim/event/loop.h"
#include "nvim/event/libuv_process.h"
#include "nvim/event/rstream.h"
#include "nvim/event/wstream.h"
#include "nvim/event/socket.h"
#include "nvim/msgpack_rpc/helpers.h"
#include "nvim/vim.h"
#include "nvim/main.h"
#include "nvim/ascii.h" #include "nvim/ascii.h"
#include "nvim/memory.h" #include "nvim/channel.h"
#include "nvim/eval.h" #include "nvim/eval.h"
#include "nvim/os_unix.h" #include "nvim/event/libuv_process.h"
#include "nvim/message.h" #include "nvim/event/loop.h"
#include "nvim/map.h" #include "nvim/event/rstream.h"
#include "nvim/log.h" #include "nvim/event/socket.h"
#include "nvim/misc1.h" #include "nvim/event/wstream.h"
#include "nvim/lib/kvec.h" #include "nvim/lib/kvec.h"
#include "nvim/log.h"
#include "nvim/main.h"
#include "nvim/map.h"
#include "nvim/memory.h"
#include "nvim/message.h"
#include "nvim/misc1.h"
#include "nvim/msgpack_rpc/channel.h"
#include "nvim/msgpack_rpc/helpers.h"
#include "nvim/os/input.h" #include "nvim/os/input.h"
#include "nvim/os_unix.h"
#include "nvim/ui.h" #include "nvim/ui.h"
#include "nvim/vim.h"
#if MIN_LOG_LEVEL > DEBUG_LOG_LEVEL #if MIN_LOG_LEVEL > DEBUG_LOG_LEVEL
#define log_client_msg(...) #define log_client_msg(...)
@@ -116,10 +115,7 @@ bool rpc_send_event(uint64_t id, const char *name, Array args)
/// @param args Array with method arguments /// @param args Array with method arguments
/// @param[out] error True if the return value is an error /// @param[out] error True if the return value is an error
/// @return Whatever the remote method returned /// @return Whatever the remote method returned
Object rpc_send_call(uint64_t id, Object rpc_send_call(uint64_t id, const char *method_name, Array args, Error *err)
const char *method_name,
Array args,
Error *err)
{ {
Channel *channel = NULL; Channel *channel = NULL;
@@ -206,8 +202,7 @@ void rpc_unsubscribe(uint64_t id, char *event)
unsubscribe(channel, event); unsubscribe(channel, event);
} }
static void receive_msgpack(Stream *stream, RBuffer *rbuf, size_t c, static void receive_msgpack(Stream *stream, RBuffer *rbuf, size_t c, void *data, bool eof)
void *data, bool eof)
{ {
Channel *channel = data; Channel *channel = data;
channel_incref(channel); channel_incref(channel);
@@ -463,10 +458,7 @@ static void send_error(Channel *chan, MessageType type, uint32_t id, char *err)
api_clear_error(&e); api_clear_error(&e);
} }
static void send_request(Channel *channel, static void send_request(Channel *channel, uint32_t id, const char *name, Array args)
uint32_t id,
const char *name,
Array args)
{ {
const String method = cstr_as_string((char *)name); const String method = cstr_as_string((char *)name);
channel_write(channel, serialize_request(channel->id, channel_write(channel, serialize_request(channel->id,
@@ -477,9 +469,7 @@ static void send_request(Channel *channel,
1)); 1));
} }
static void send_event(Channel *channel, static void send_event(Channel *channel, const char *name, Array args)
const char *name,
Array args)
{ {
const String method = cstr_as_string((char *)name); const String method = cstr_as_string((char *)name);
channel_write(channel, serialize_request(channel->id, channel_write(channel, serialize_request(channel->id,
@@ -634,12 +624,8 @@ static void call_set_error(Channel *channel, char *msg, int loglevel)
channel_close(channel->id, kChannelPartRpc, NULL); channel_close(channel->id, kChannelPartRpc, NULL);
} }
static WBuffer *serialize_request(uint64_t channel_id, static WBuffer *serialize_request(uint64_t channel_id, uint32_t request_id, const String method,
uint32_t request_id, Array args, msgpack_sbuffer *sbuffer, size_t refcount)
const String method,
Array args,
msgpack_sbuffer *sbuffer,
size_t refcount)
{ {
msgpack_packer pac; msgpack_packer pac;
msgpack_packer_init(&pac, sbuffer, msgpack_sbuffer_write); msgpack_packer_init(&pac, sbuffer, msgpack_sbuffer_write);
@@ -654,12 +640,8 @@ static WBuffer *serialize_request(uint64_t channel_id,
return rv; return rv;
} }
static WBuffer *serialize_response(uint64_t channel_id, static WBuffer *serialize_response(uint64_t channel_id, MessageType type, uint32_t response_id,
MessageType type, Error *err, Object arg, msgpack_sbuffer *sbuffer)
uint32_t response_id,
Error *err,
Object arg,
msgpack_sbuffer *sbuffer)
{ {
msgpack_packer pac; msgpack_packer pac;
msgpack_packer_init(&pac, sbuffer, msgpack_sbuffer_write); msgpack_packer_init(&pac, sbuffer, msgpack_sbuffer_write);
@@ -733,8 +715,7 @@ static const char *const msgpack_error_messages[] = {
[MSGPACK_UNPACK_NOMEM_ERROR + MUR_OFF] = "not enough memory", [MSGPACK_UNPACK_NOMEM_ERROR + MUR_OFF] = "not enough memory",
}; };
static void log_server_msg(uint64_t channel_id, static void log_server_msg(uint64_t channel_id, msgpack_sbuffer *packed)
msgpack_sbuffer *packed)
{ {
msgpack_unpacked unpacked; msgpack_unpacked unpacked;
msgpack_unpacked_init(&unpacked); msgpack_unpacked_init(&unpacked);
@@ -762,8 +743,7 @@ static void log_server_msg(uint64_t channel_id,
.type = MSGPACK_OBJECT_STR, .type = MSGPACK_OBJECT_STR,
.via.str = { .via.str = {
.ptr = (char *)msgpack_error_messages[result + MUR_OFF], .ptr = (char *)msgpack_error_messages[result + MUR_OFF],
.size = (uint32_t)strlen( .size = (uint32_t)strlen(msgpack_error_messages[result + MUR_OFF]),
msgpack_error_messages[result + MUR_OFF]),
}, },
}); });
break; break;
@@ -771,9 +751,7 @@ static void log_server_msg(uint64_t channel_id,
} }
} }
static void log_client_msg(uint64_t channel_id, static void log_client_msg(uint64_t channel_id, bool is_request, msgpack_object msg)
bool is_request,
msgpack_object msg)
{ {
DLOGN("RPC <-ch %" PRIu64 ": ", channel_id); DLOGN("RPC <-ch %" PRIu64 ": ", channel_id);
log_lock(); log_lock();

View File

@@ -1,19 +1,18 @@
// This is an open source non-commercial project. Dear PVS-Studio, please check // This is an open source non-commercial project. Dear PVS-Studio, please check
// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com // it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
#include <stdbool.h>
#include <inttypes.h> #include <inttypes.h>
#include <msgpack.h> #include <msgpack.h>
#include <stdbool.h>
#include "nvim/api/private/dispatch.h" #include "nvim/api/private/dispatch.h"
#include "nvim/api/private/helpers.h" #include "nvim/api/private/helpers.h"
#include "nvim/msgpack_rpc/helpers.h" #include "nvim/assert.h"
#include "nvim/lib/kvec.h" #include "nvim/lib/kvec.h"
#include "nvim/vim.h"
#include "nvim/log.h" #include "nvim/log.h"
#include "nvim/memory.h" #include "nvim/memory.h"
#include "nvim/assert.h" #include "nvim/msgpack_rpc/helpers.h"
#include "nvim/vim.h"
#ifdef INCLUDE_GENERATED_DECLARATIONS #ifdef INCLUDE_GENERATED_DECLARATIONS
# include "msgpack_rpc/helpers.c.generated.h" # include "msgpack_rpc/helpers.c.generated.h"
@@ -48,7 +47,9 @@ static msgpack_sbuffer sbuffer;
} \ } \
\ \
static void msgpack_rpc_from_##lt(Integer o, msgpack_packer *res) \ static void msgpack_rpc_from_##lt(Integer o, msgpack_packer *res) \
/* uncrustify:indent-off */ \
FUNC_ATTR_NONNULL_ARG(2) \ FUNC_ATTR_NONNULL_ARG(2) \
/* uncrustify:indent-on */ \
{ \ { \
msgpack_packer pac; \ msgpack_packer pac; \
msgpack_packer_init(&pac, &sbuffer, msgpack_sbuffer_write); \ msgpack_packer_init(&pac, &sbuffer, msgpack_sbuffer_write); \
@@ -100,20 +101,17 @@ bool msgpack_rpc_to_object(const msgpack_object *const obj, Object *const arg)
*cur.aobj = NIL; *cur.aobj = NIL;
} }
switch (cur.mobj->type) { switch (cur.mobj->type) {
case MSGPACK_OBJECT_NIL: { case MSGPACK_OBJECT_NIL:
break; break;
} case MSGPACK_OBJECT_BOOLEAN:
case MSGPACK_OBJECT_BOOLEAN: {
*cur.aobj = BOOLEAN_OBJ(cur.mobj->via.boolean); *cur.aobj = BOOLEAN_OBJ(cur.mobj->via.boolean);
break; break;
} case MSGPACK_OBJECT_NEGATIVE_INTEGER:
case MSGPACK_OBJECT_NEGATIVE_INTEGER: {
STATIC_ASSERT(sizeof(Integer) == sizeof(cur.mobj->via.i64), STATIC_ASSERT(sizeof(Integer) == sizeof(cur.mobj->via.i64),
"Msgpack integer size does not match API integer"); "Msgpack integer size does not match API integer");
*cur.aobj = INTEGER_OBJ(cur.mobj->via.i64); *cur.aobj = INTEGER_OBJ(cur.mobj->via.i64);
break; break;
} case MSGPACK_OBJECT_POSITIVE_INTEGER:
case MSGPACK_OBJECT_POSITIVE_INTEGER: {
STATIC_ASSERT(sizeof(Integer) == sizeof(cur.mobj->via.u64), STATIC_ASSERT(sizeof(Integer) == sizeof(cur.mobj->via.u64),
"Msgpack integer size does not match API integer"); "Msgpack integer size does not match API integer");
if (cur.mobj->via.u64 > API_INTEGER_MAX) { if (cur.mobj->via.u64 > API_INTEGER_MAX) {
@@ -122,7 +120,6 @@ bool msgpack_rpc_to_object(const msgpack_object *const obj, Object *const arg)
*cur.aobj = INTEGER_OBJ((Integer)cur.mobj->via.u64); *cur.aobj = INTEGER_OBJ((Integer)cur.mobj->via.u64);
} }
break; break;
}
#ifdef NVIM_MSGPACK_HAS_FLOAT32 #ifdef NVIM_MSGPACK_HAS_FLOAT32
case MSGPACK_OBJECT_FLOAT32: case MSGPACK_OBJECT_FLOAT32:
case MSGPACK_OBJECT_FLOAT64: case MSGPACK_OBJECT_FLOAT64:
@@ -136,7 +133,7 @@ bool msgpack_rpc_to_object(const msgpack_object *const obj, Object *const arg)
break; break;
} }
#define STR_CASE(type, attr, obj, dest, conv) \ #define STR_CASE(type, attr, obj, dest, conv) \
case type: { \ case type: { \
dest = conv(((String) { \ dest = conv(((String) { \
.size = obj->via.attr.size, \ .size = obj->via.attr.size, \
.data = (obj->via.attr.ptr == NULL || obj->via.attr.size == 0 \ .data = (obj->via.attr.ptr == NULL || obj->via.attr.size == 0 \
@@ -144,7 +141,7 @@ bool msgpack_rpc_to_object(const msgpack_object *const obj, Object *const arg)
: xmemdupz(obj->via.attr.ptr, obj->via.attr.size)), \ : xmemdupz(obj->via.attr.ptr, obj->via.attr.size)), \
})); \ })); \
break; \ break; \
} }
STR_CASE(MSGPACK_OBJECT_STR, str, cur.mobj, *cur.aobj, STRING_OBJ) STR_CASE(MSGPACK_OBJECT_STR, str, cur.mobj, *cur.aobj, STRING_OBJ)
STR_CASE(MSGPACK_OBJECT_BIN, bin, cur.mobj, *cur.aobj, STRING_OBJ) STR_CASE(MSGPACK_OBJECT_BIN, bin, cur.mobj, *cur.aobj, STRING_OBJ)
case MSGPACK_OBJECT_ARRAY: { case MSGPACK_OBJECT_ARRAY: {
@@ -204,11 +201,10 @@ bool msgpack_rpc_to_object(const msgpack_object *const obj, Object *const arg)
#endif #endif
case MSGPACK_OBJECT_EXT: case MSGPACK_OBJECT_EXT:
case MSGPACK_OBJECT_MAP: case MSGPACK_OBJECT_MAP:
case MSGPACK_OBJECT_ARRAY: { case MSGPACK_OBJECT_ARRAY:
ret = false; ret = false;
break; break;
} }
}
if (ret) { if (ret) {
kvi_push(stack, ((MPToAPIObjectStackItem) { kvi_push(stack, ((MPToAPIObjectStackItem) {
.mobj = &cur.mobj->via.map.ptr[idx].val, .mobj = &cur.mobj->via.map.ptr[idx].val,
@@ -230,23 +226,20 @@ bool msgpack_rpc_to_object(const msgpack_object *const obj, Object *const arg)
} }
break; break;
} }
case MSGPACK_OBJECT_EXT: { case MSGPACK_OBJECT_EXT:
switch ((ObjectType)(cur.mobj->via.ext.type + EXT_OBJECT_TYPE_SHIFT)) { switch ((ObjectType)(cur.mobj->via.ext.type + EXT_OBJECT_TYPE_SHIFT)) {
case kObjectTypeBuffer: { case kObjectTypeBuffer:
cur.aobj->type = kObjectTypeBuffer; cur.aobj->type = kObjectTypeBuffer;
ret = msgpack_rpc_to_buffer(cur.mobj, &cur.aobj->data.integer); ret = msgpack_rpc_to_buffer(cur.mobj, &cur.aobj->data.integer);
break; break;
} case kObjectTypeWindow:
case kObjectTypeWindow: {
cur.aobj->type = kObjectTypeWindow; cur.aobj->type = kObjectTypeWindow;
ret = msgpack_rpc_to_window(cur.mobj, &cur.aobj->data.integer); ret = msgpack_rpc_to_window(cur.mobj, &cur.aobj->data.integer);
break; break;
} case kObjectTypeTabpage:
case kObjectTypeTabpage: {
cur.aobj->type = kObjectTypeTabpage; cur.aobj->type = kObjectTypeTabpage;
ret = msgpack_rpc_to_tabpage(cur.mobj, &cur.aobj->data.integer); ret = msgpack_rpc_to_tabpage(cur.mobj, &cur.aobj->data.integer);
break; break;
}
case kObjectTypeNil: case kObjectTypeNil:
case kObjectTypeBoolean: case kObjectTypeBoolean:
case kObjectTypeInteger: case kObjectTypeInteger:
@@ -254,12 +247,10 @@ bool msgpack_rpc_to_object(const msgpack_object *const obj, Object *const arg)
case kObjectTypeString: case kObjectTypeString:
case kObjectTypeArray: case kObjectTypeArray:
case kObjectTypeDictionary: case kObjectTypeDictionary:
case kObjectTypeLuaRef: { case kObjectTypeLuaRef:
break; break;
} }
}
break; break;
}
#undef STR_CASE #undef STR_CASE
} }
if (!cur.container) { if (!cur.container) {
@@ -270,8 +261,7 @@ bool msgpack_rpc_to_object(const msgpack_object *const obj, Object *const arg)
return ret; return ret;
} }
static bool msgpack_rpc_to_string(const msgpack_object *const obj, static bool msgpack_rpc_to_string(const msgpack_object *const obj, String *const arg)
String *const arg)
FUNC_ATTR_NONNULL_ALL FUNC_ATTR_NONNULL_ALL
{ {
if (obj->type == MSGPACK_OBJECT_BIN || obj->type == MSGPACK_OBJECT_STR) { if (obj->type == MSGPACK_OBJECT_BIN || obj->type == MSGPACK_OBJECT_STR) {
@@ -303,8 +293,7 @@ bool msgpack_rpc_to_array(const msgpack_object *const obj, Array *const arg)
return true; return true;
} }
bool msgpack_rpc_to_dictionary(const msgpack_object *const obj, bool msgpack_rpc_to_dictionary(const msgpack_object *const obj, Dictionary *const arg)
Dictionary *const arg)
FUNC_ATTR_NONNULL_ALL FUNC_ATTR_NONNULL_ALL
{ {
if (obj->type != MSGPACK_OBJECT_MAP) { if (obj->type != MSGPACK_OBJECT_MAP) {
@@ -386,41 +375,33 @@ void msgpack_rpc_from_object(const Object result, msgpack_packer *const res)
"Buffer, window and tabpage enum items are in order"); "Buffer, window and tabpage enum items are in order");
switch (cur.aobj->type) { switch (cur.aobj->type) {
case kObjectTypeNil: case kObjectTypeNil:
case kObjectTypeLuaRef: { case kObjectTypeLuaRef:
// TODO(bfredl): could also be an error. Though kObjectTypeLuaRef // TODO(bfredl): could also be an error. Though kObjectTypeLuaRef
// should only appear when the caller has opted in to handle references, // should only appear when the caller has opted in to handle references,
// see nlua_pop_Object. // see nlua_pop_Object.
msgpack_pack_nil(res); msgpack_pack_nil(res);
break; break;
} case kObjectTypeBoolean:
case kObjectTypeBoolean: {
msgpack_rpc_from_boolean(cur.aobj->data.boolean, res); msgpack_rpc_from_boolean(cur.aobj->data.boolean, res);
break; break;
} case kObjectTypeInteger:
case kObjectTypeInteger: {
msgpack_rpc_from_integer(cur.aobj->data.integer, res); msgpack_rpc_from_integer(cur.aobj->data.integer, res);
break; break;
} case kObjectTypeFloat:
case kObjectTypeFloat: {
msgpack_rpc_from_float(cur.aobj->data.floating, res); msgpack_rpc_from_float(cur.aobj->data.floating, res);
break; break;
} case kObjectTypeString:
case kObjectTypeString: {
msgpack_rpc_from_string(cur.aobj->data.string, res); msgpack_rpc_from_string(cur.aobj->data.string, res);
break; break;
} case kObjectTypeBuffer:
case kObjectTypeBuffer: {
msgpack_rpc_from_buffer(cur.aobj->data.integer, res); msgpack_rpc_from_buffer(cur.aobj->data.integer, res);
break; break;
} case kObjectTypeWindow:
case kObjectTypeWindow: {
msgpack_rpc_from_window(cur.aobj->data.integer, res); msgpack_rpc_from_window(cur.aobj->data.integer, res);
break; break;
} case kObjectTypeTabpage:
case kObjectTypeTabpage: {
msgpack_rpc_from_tabpage(cur.aobj->data.integer, res); msgpack_rpc_from_tabpage(cur.aobj->data.integer, res);
break; break;
}
case kObjectTypeArray: { case kObjectTypeArray: {
const size_t size = cur.aobj->data.array.size; const size_t size = cur.aobj->data.array.size;
if (cur.container) { if (cur.container) {
@@ -495,9 +476,7 @@ void msgpack_rpc_from_dictionary(Dictionary result, msgpack_packer *res)
} }
/// Serializes a msgpack-rpc request or notification(id == 0) /// Serializes a msgpack-rpc request or notification(id == 0)
void msgpack_rpc_serialize_request(uint32_t request_id, void msgpack_rpc_serialize_request(uint32_t request_id, const String method, Array args,
const String method,
Array args,
msgpack_packer *pac) msgpack_packer *pac)
FUNC_ATTR_NONNULL_ARG(4) FUNC_ATTR_NONNULL_ARG(4)
{ {
@@ -513,9 +492,7 @@ void msgpack_rpc_serialize_request(uint32_t request_id,
} }
/// Serializes a msgpack-rpc response /// Serializes a msgpack-rpc response
void msgpack_rpc_serialize_response(uint32_t response_id, void msgpack_rpc_serialize_response(uint32_t response_id, Error *err, Object arg,
Error *err,
Object arg,
msgpack_packer *pac) msgpack_packer *pac)
FUNC_ATTR_NONNULL_ARG(2, 4) FUNC_ATTR_NONNULL_ARG(2, 4)
{ {
@@ -567,8 +544,7 @@ static msgpack_object *msgpack_rpc_msg_id(msgpack_object *req)
return obj->type == MSGPACK_OBJECT_POSITIVE_INTEGER ? obj : NULL; return obj->type == MSGPACK_OBJECT_POSITIVE_INTEGER ? obj : NULL;
} }
MessageType msgpack_rpc_validate(uint32_t *response_id, msgpack_object *req, MessageType msgpack_rpc_validate(uint32_t *response_id, msgpack_object *req, Error *err)
Error *err)
{ {
*response_id = 0; *response_id = 0;
// Validate the basic structure of the msgpack-rpc payload // Validate the basic structure of the msgpack-rpc payload

View File

@@ -2,24 +2,24 @@
// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com // it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
#include <assert.h> #include <assert.h>
#include <inttypes.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <inttypes.h>
#include "nvim/ascii.h"
#include "nvim/eval.h"
#include "nvim/event/socket.h"
#include "nvim/fileio.h"
#include "nvim/garray.h"
#include "nvim/log.h"
#include "nvim/main.h"
#include "nvim/memory.h"
#include "nvim/msgpack_rpc/channel.h" #include "nvim/msgpack_rpc/channel.h"
#include "nvim/msgpack_rpc/server.h" #include "nvim/msgpack_rpc/server.h"
#include "nvim/os/os.h" #include "nvim/os/os.h"
#include "nvim/event/socket.h"
#include "nvim/ascii.h"
#include "nvim/eval.h"
#include "nvim/garray.h"
#include "nvim/vim.h"
#include "nvim/main.h"
#include "nvim/memory.h"
#include "nvim/log.h"
#include "nvim/fileio.h"
#include "nvim/path.h" #include "nvim/path.h"
#include "nvim/strings.h" #include "nvim/strings.h"
#include "nvim/vim.h"
#define MAX_CONNECTIONS 32 #define MAX_CONNECTIONS 32
#define LISTEN_ADDRESS_ENV_VAR "NVIM_LISTEN_ADDRESS" #define LISTEN_ADDRESS_ENV_VAR "NVIM_LISTEN_ADDRESS"

View File

@@ -2473,9 +2473,8 @@ bool do_mouse(oparg_T *oap, int c, int dir, long count, bool fixindent)
in_tab_line = true; in_tab_line = true;
c1 = tab_page_click_defs[mouse_col].tabnr; c1 = tab_page_click_defs[mouse_col].tabnr;
switch (tab_page_click_defs[mouse_col].type) { switch (tab_page_click_defs[mouse_col].type) {
case kStlClickDisabled: { case kStlClickDisabled:
break; break;
}
case kStlClickTabClose: { case kStlClickTabClose: {
tabpage_T *tp; tabpage_T *tp;
@@ -2494,7 +2493,7 @@ bool do_mouse(oparg_T *oap, int c, int dir, long count, bool fixindent)
} }
break; break;
} }
case kStlClickTabSwitch: { case kStlClickTabSwitch:
if ((mod_mask & MOD_MASK_MULTI_CLICK) == MOD_MASK_2CLICK) { if ((mod_mask & MOD_MASK_MULTI_CLICK) == MOD_MASK_2CLICK) {
// double click opens new page // double click opens new page
end_visual_mode(); end_visual_mode();
@@ -2511,7 +2510,6 @@ bool do_mouse(oparg_T *oap, int c, int dir, long count, bool fixindent)
} }
} }
break; break;
}
case kStlClickFuncRun: { case kStlClickFuncRun: {
typval_T argv[] = { typval_T argv[] = {
{ {

View File

@@ -6221,24 +6221,20 @@ static void set_clipboard(int name, yankreg_T *reg)
char regtype; char regtype;
switch (reg->y_type) { switch (reg->y_type) {
case kMTLineWise: { case kMTLineWise:
regtype = 'V'; regtype = 'V';
tv_list_append_string(lines, NULL, 0); tv_list_append_string(lines, NULL, 0);
break; break;
} case kMTCharWise:
case kMTCharWise: {
regtype = 'v'; regtype = 'v';
break; break;
} case kMTBlockWise:
case kMTBlockWise: {
regtype = 'b'; regtype = 'b';
tv_list_append_string(lines, NULL, 0); tv_list_append_string(lines, NULL, 0);
break; break;
} case kMTUnknown:
case kMTUnknown: {
abort(); abort();
} }
}
list_T *args = tv_list_alloc(3); list_T *args = tv_list_alloc(3);
tv_list_append_list(args, lines); tv_list_append_list(args, lines);