channel.c: refactor spaghetti code

channel.c: WIP remove redundant method check and added FUNC_ATTR_NONNULL_ALL macro

channel.c channel_defs.h helpers.c: added Error field to RequestEvent, added no_op handler func

channel.c: use const char* instead of string and cleanup

channel.c; channel_defs.h; helpers.c: removed error from event again; send errors directly to the channel without using handlers and events

channel.c: fixed memory leak and lint errors

api/private/dispatch.c; api/vim.c; msgpack_rpc/channel.c msgpack_rpc/helpers.c added Error* field to msgpack_get_handler_for; further refactored channel.c

channel.c:323 changed order of evaluation in if statement

channel.c: removed superflous whitespace

dispatch.c: review comment
This commit is contained in:
micha
2018-06-27 17:08:55 +02:00
parent 4874214139
commit ed02278e42
4 changed files with 27 additions and 46 deletions

View File

@@ -1162,11 +1162,12 @@ Array nvim_call_atomic(uint64_t channel_id, Array calls, Error *err)
}
Array args = call.items[1].data.array;
MsgpackRpcRequestHandler handler = msgpack_rpc_get_handler_for(name.data,
name.size);
if (handler.fn == msgpack_rpc_handle_missing_method) {
api_set_error(&nested_error, kErrorTypeException, "Invalid method: %s",
name.size > 0 ? name.data : "<empty>");
MsgpackRpcRequestHandler handler =
msgpack_rpc_get_handler_for(name.data,
name.size,
&nested_error);
if (ERROR_SET(&nested_error)) {
break;
}
Object result = handler.fn(channel_id, args, &nested_error);