aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/api/private/defs.h
diff options
context:
space:
mode:
authorThiago de Arruda <tpadilha84@gmail.com>2014-05-23 15:49:38 -0300
committerThiago de Arruda <tpadilha84@gmail.com>2014-05-23 16:06:58 -0300
commit92307201b51c399e8109c91cc131ff3602389db1 (patch)
treef79a10e34412b7876d6a997f662bb7b8cf546f12 /src/nvim/api/private/defs.h
parent5fdf854f78eb1a87acb2d28b3d941d988bd1b74e (diff)
downloadrneovim-92307201b51c399e8109c91cc131ff3602389db1.tar.gz
rneovim-92307201b51c399e8109c91cc131ff3602389db1.tar.bz2
rneovim-92307201b51c399e8109c91cc131ff3602389db1.zip
API: Refactor: Generalize buffer, window and tabpage types/functions
- Extract remote types definitions into a macro - Extract msgpack_rpc helper functions for remote types into a macro
Diffstat (limited to 'src/nvim/api/private/defs.h')
-rw-r--r--src/nvim/api/private/defs.h14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/nvim/api/private/defs.h b/src/nvim/api/private/defs.h
index 3ee50310fb..9b0639067d 100644
--- a/src/nvim/api/private/defs.h
+++ b/src/nvim/api/private/defs.h
@@ -5,6 +5,14 @@
#include <stdbool.h>
#include <string.h>
+#define REMOTE_TYPE(type) typedef Integer type
+
+#define TYPED_ARRAY_OF(type) \
+ typedef struct { \
+ type *items; \
+ size_t size; \
+ } type##Array
+
// Basic types
typedef struct {
char msg[256];
@@ -20,9 +28,9 @@ typedef struct {
size_t size;
} String;
-typedef Integer Buffer;
-typedef Integer Window;
-typedef Integer Tabpage;
+REMOTE_TYPE(Buffer);
+REMOTE_TYPE(Window);
+REMOTE_TYPE(Tabpage);
typedef struct object Object;