aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/os/msgpack_rpc_helpers.c
diff options
context:
space:
mode:
authorThiago de Arruda <tpadilha84@gmail.com>2014-09-07 18:48:10 -0300
committerThiago de Arruda <tpadilha84@gmail.com>2014-09-12 13:25:28 -0300
commitd5a60d17fbca33ca96124288e69937a276d3abda (patch)
treefa849532d5b6fd2e54509fc8078d1e6797be9f3c /src/nvim/os/msgpack_rpc_helpers.c
parent505985b870b4b9d7cae07354518b28dd12ee5b6f (diff)
downloadrneovim-d5a60d17fbca33ca96124288e69937a276d3abda.tar.gz
rneovim-d5a60d17fbca33ca96124288e69937a276d3abda.tar.bz2
rneovim-d5a60d17fbca33ca96124288e69937a276d3abda.zip
api/msgpack-rpc: Remove specialized array types
Specialized array types(BufferArray, WindowArray, etc) were added to the API for two main reasons: - msgpack used to lack a way of serializing appliaction-specific types and there was no obvious way of making an API function accept/return arrays of custom objects such as buffers(which are represented as integers, so clients didn't have a way to distinguish from normal numbers) - Let clients in statically-typed languages that support generics have a better typed API With msgpack 2.0 EXT type the first item is no longer a factor and this commit starts by removing the specialized array types. The second item will be addressed in the future by making the API metadata return extra useful information for statically-typed languages.
Diffstat (limited to 'src/nvim/os/msgpack_rpc_helpers.c')
-rw-r--r--src/nvim/os/msgpack_rpc_helpers.c74
1 files changed, 0 insertions, 74 deletions
diff --git a/src/nvim/os/msgpack_rpc_helpers.c b/src/nvim/os/msgpack_rpc_helpers.c
index eaba3b9785..3210f2b6b2 100644
--- a/src/nvim/os/msgpack_rpc_helpers.c
+++ b/src/nvim/os/msgpack_rpc_helpers.c
@@ -19,42 +19,6 @@
msgpack_pack_uint64(res, result); \
}
-#define TYPED_ARRAY_IMPL(t, lt) \
- bool msgpack_rpc_to_##lt##array(msgpack_object *obj, t##Array *arg) \
- { \
- if (obj->type != MSGPACK_OBJECT_ARRAY) { \
- return false; \
- } \
- \
- arg->size = obj->via.array.size; \
- arg->items = xcalloc(obj->via.array.size, sizeof(t)); \
- \
- for (size_t i = 0; i < obj->via.array.size; i++) { \
- if (!msgpack_rpc_to_##lt(obj->via.array.ptr + i, &arg->items[i])) { \
- return false; \
- } \
- } \
- \
- return true; \
- } \
- \
- void msgpack_rpc_from_##lt##array(t##Array result, msgpack_packer *res) \
- { \
- msgpack_pack_array(res, result.size); \
- \
- for (size_t i = 0; i < result.size; i++) { \
- msgpack_rpc_from_##lt(result.items[i], res); \
- } \
- } \
- \
- void msgpack_rpc_free_##lt##array(t##Array value) { \
- for (size_t i = 0; i < value.size; i++) { \
- msgpack_rpc_free_##lt(value.items[i]); \
- } \
- \
- free(value.items); \
- }
-
bool msgpack_rpc_to_boolean(msgpack_object *obj, Boolean *arg)
{
*arg = obj->via.boolean;
@@ -249,22 +213,6 @@ void msgpack_rpc_from_object(Object result, msgpack_packer *res)
msgpack_rpc_from_tabpage(result.data.tabpage, res);
break;
- case kObjectTypeStringArray:
- msgpack_rpc_from_stringarray(result.data.stringarray, res);
- break;
-
- case kObjectTypeBufferArray:
- msgpack_rpc_from_bufferarray(result.data.bufferarray, res);
- break;
-
- case kObjectTypeWindowArray:
- msgpack_rpc_from_windowarray(result.data.windowarray, res);
- break;
-
- case kObjectTypeTabpageArray:
- msgpack_rpc_from_tabpagearray(result.data.tabpagearray, res);
- break;
-
case kObjectTypeDictionary:
msgpack_rpc_from_dictionary(result.data.dictionary, res);
break;
@@ -327,22 +275,6 @@ void msgpack_rpc_free_object(Object value)
msgpack_rpc_free_array(value.data.array);
break;
- case kObjectTypeStringArray:
- msgpack_rpc_free_stringarray(value.data.stringarray);
- break;
-
- case kObjectTypeBufferArray:
- msgpack_rpc_free_bufferarray(value.data.bufferarray);
- break;
-
- case kObjectTypeWindowArray:
- msgpack_rpc_free_windowarray(value.data.windowarray);
- break;
-
- case kObjectTypeTabpageArray:
- msgpack_rpc_free_tabpagearray(value.data.tabpagearray);
- break;
-
case kObjectTypeDictionary:
msgpack_rpc_free_dictionary(value.data.dictionary);
break;
@@ -374,9 +306,3 @@ void msgpack_rpc_free_dictionary(Dictionary value)
REMOTE_FUNCS_IMPL(Buffer, buffer)
REMOTE_FUNCS_IMPL(Window, window)
REMOTE_FUNCS_IMPL(Tabpage, tabpage)
-
-TYPED_ARRAY_IMPL(Buffer, buffer)
-TYPED_ARRAY_IMPL(Window, window)
-TYPED_ARRAY_IMPL(Tabpage, tabpage)
-TYPED_ARRAY_IMPL(String, string)
-