aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/api/private/handle.c
diff options
context:
space:
mode:
authorBjörn Linse <bjorn.linse@gmail.com>2016-09-01 18:32:37 +0200
committerGitHub <noreply@github.com>2016-09-01 18:32:37 +0200
commitc6ac4f84b16324b56c38bd2003f037d995262fa1 (patch)
tree5ece44d718f6511d468ac4fe35030a795044999c /src/nvim/api/private/handle.c
parent0ade1bb7067d0cdb9b059fb66a8c4b868408be9c (diff)
parentacb7c826b3df50bd9825baf3b2ffaaa79c8b80df (diff)
downloadrneovim-c6ac4f84b16324b56c38bd2003f037d995262fa1.tar.gz
rneovim-c6ac4f84b16324b56c38bd2003f037d995262fa1.tar.bz2
rneovim-c6ac4f84b16324b56c38bd2003f037d995262fa1.zip
Merge pull request #4934 from bfredl/api
make the API callable from vimL, rename API functions to common nvim_ prefix
Diffstat (limited to 'src/nvim/api/private/handle.c')
-rw-r--r--src/nvim/api/private/handle.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/src/nvim/api/private/handle.c b/src/nvim/api/private/handle.c
index 69df7294ad..acb0fb332a 100644
--- a/src/nvim/api/private/handle.c
+++ b/src/nvim/api/private/handle.c
@@ -5,30 +5,26 @@
#include "nvim/map.h"
#include "nvim/api/private/handle.h"
-#define HANDLE_INIT(name) name##_handles = pmap_new(uint64_t)()
+#define HANDLE_INIT(name) name##_handles = pmap_new(handle_T)()
#define HANDLE_IMPL(type, name) \
- static PMap(uint64_t) *name##_handles = NULL; \
+ static PMap(handle_T) *name##_handles = NULL; /* NOLINT */ \
\
- type *handle_get_##name(uint64_t handle) \
+ type *handle_get_##name(handle_T handle) \
{ \
- return pmap_get(uint64_t)(name##_handles, handle); \
+ return pmap_get(handle_T)(name##_handles, handle); \
} \
\
void handle_register_##name(type *name) \
{ \
- assert(!name->handle); \
- name->handle = next_handle++; \
- pmap_put(uint64_t)(name##_handles, name->handle, name); \
+ pmap_put(handle_T)(name##_handles, name->handle, name); \
} \
\
void handle_unregister_##name(type *name) \
{ \
- pmap_del(uint64_t)(name##_handles, name->handle); \
+ pmap_del(handle_T)(name##_handles, name->handle); \
}
-static uint64_t next_handle = 1;
-
HANDLE_IMPL(buf_T, buffer)
HANDLE_IMPL(win_T, window)
HANDLE_IMPL(tabpage_T, tabpage)