diff options
author | Björn Linse <bjorn.linse@gmail.com> | 2021-08-22 11:25:59 +0200 |
---|---|---|
committer | Björn Linse <bjorn.linse@gmail.com> | 2021-08-22 11:28:47 +0200 |
commit | c265fd31ab2b0307650ad94e1ea272e9360c345f (patch) | |
tree | 9ca3efcc04236190d15a418e1ff0a2ca1d4d6a1c /src/nvim/api/private/handle.c | |
parent | b888018aed249174aad7586859ac5142f1a3ef10 (diff) | |
download | rneovim-c265fd31ab2b0307650ad94e1ea272e9360c345f.tar.gz rneovim-c265fd31ab2b0307650ad94e1ea272e9360c345f.tar.bz2 rneovim-c265fd31ab2b0307650ad94e1ea272e9360c345f.zip |
refactor(api): remove unneccesary indirection around handles
These things are just maps to pointers, no need to perform
a huge song and dance around it.
Diffstat (limited to 'src/nvim/api/private/handle.c')
-rw-r--r-- | src/nvim/api/private/handle.c | 40 |
1 files changed, 0 insertions, 40 deletions
diff --git a/src/nvim/api/private/handle.c b/src/nvim/api/private/handle.c deleted file mode 100644 index eb96192af2..0000000000 --- a/src/nvim/api/private/handle.c +++ /dev/null @@ -1,40 +0,0 @@ -// This is an open source non-commercial project. Dear PVS-Studio, please check -// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com - -#include <assert.h> -#include <stdint.h> - -#include "nvim/vim.h" -#include "nvim/map.h" -#include "nvim/api/private/handle.h" - -#define HANDLE_INIT(name) name##_handles = pmap_new(handle_T)() - -#define HANDLE_IMPL(type, name) \ - static PMap(handle_T) *name##_handles = NULL; /* NOLINT */ \ - \ - type *handle_get_##name(handle_T handle) \ - { \ - return pmap_get(handle_T)(name##_handles, handle); \ - } \ - \ - void handle_register_##name(type *name) \ - { \ - pmap_put(handle_T)(name##_handles, name->handle, name); \ - } \ - \ - void handle_unregister_##name(type *name) \ - { \ - pmap_del(handle_T)(name##_handles, name->handle); \ - } - -HANDLE_IMPL(buf_T, buffer) -HANDLE_IMPL(win_T, window) -HANDLE_IMPL(tabpage_T, tabpage) - -void handle_init(void) -{ - HANDLE_INIT(buffer); - HANDLE_INIT(window); - HANDLE_INIT(tabpage); -} |