From 1e67b13fdcb6ed7f2a951b9053f0a829b3a48906 Mon Sep 17 00:00:00 2001 From: Thiago de Arruda Date: Fri, 23 May 2014 15:49:40 -0300 Subject: API: Refactor: Add macro infrastructure for typed arrays - Add macros supporting typed arrays in the remote API - Refactor StringArray-related functions on top of the new macros --- src/nvim/os/msgpack_rpc.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/nvim/os/msgpack_rpc.h') diff --git a/src/nvim/os/msgpack_rpc.h b/src/nvim/os/msgpack_rpc.h index 0f644273cd..45632c7389 100644 --- a/src/nvim/os/msgpack_rpc.h +++ b/src/nvim/os/msgpack_rpc.h @@ -8,6 +8,8 @@ #include "nvim/api/private/defs.h" +#define ARRAY_DICT_INIT {.size = 0, .items = NULL} + /// Validates the basic structure of the msgpack-rpc call and fills `res` /// with the basic response structure. /// @@ -80,9 +82,9 @@ void msgpack_rpc_from_dictionary(Dictionary result, msgpack_packer *res); #define msgpack_rpc_init_window #define msgpack_rpc_init_tabpage #define msgpack_rpc_init_object = {.type = kObjectTypeNil} -#define msgpack_rpc_init_stringarray = {.items = NULL, .size = 0} -#define msgpack_rpc_init_array = {.items = NULL, .size = 0} -#define msgpack_rpc_init_dictionary = {.items = NULL, .size = 0} +#define msgpack_rpc_init_stringarray = ARRAY_DICT_INIT +#define msgpack_rpc_init_array = ARRAY_DICT_INIT +#define msgpack_rpc_init_dictionary = ARRAY_DICT_INIT /// Helpers for freeing arguments/return value /// @@ -102,6 +104,5 @@ void msgpack_rpc_free_stringarray(StringArray value); void msgpack_rpc_free_array(Array value); void msgpack_rpc_free_dictionary(Dictionary value); - #endif // NVIM_OS_MSGPACK_RPC_H -- cgit