blob: 1b2886437f8b585459a31b55d8c71abe422dd290 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
#include <stddef.h>
#include "nvim/api/private/defs.h"
#include "nvim/api/private/dispatch.h"
#include "nvim/api/private/helpers.h"
#include "api/private/dispatch_wrappers.generated.h"
/// @param name API method name
/// @param name_len name size (includes terminating NUL)
MsgpackRpcRequestHandler msgpack_rpc_get_handler_for(const char *name, size_t name_len,
Error *error)
{
int hash = msgpack_rpc_get_handler_for_hash(name, name_len);
if (hash < 0) {
api_set_error(error, kErrorTypeException, "Invalid method: %.*s",
name_len > 0 ? (int)name_len : (int)sizeof("<empty>"),
name_len > 0 ? name : "<empty>");
return (MsgpackRpcRequestHandler){ 0 };
}
return method_handlers[hash];
}
|