From c265fd31ab2b0307650ad94e1ea272e9360c345f Mon Sep 17 00:00:00 2001 From: Björn Linse Date: Sun, 22 Aug 2021 11:25:59 +0200 Subject: 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. --- src/nvim/api/private/helpers.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/nvim/api/private/helpers.h') diff --git a/src/nvim/api/private/helpers.h b/src/nvim/api/private/helpers.h index 055abb797f..ecce6afa26 100644 --- a/src/nvim/api/private/helpers.h +++ b/src/nvim/api/private/helpers.h @@ -101,6 +101,14 @@ #define api_free_window(value) #define api_free_tabpage(value) +EXTERN PMap(handle_T) buffer_handles INIT(= MAP_INIT); +EXTERN PMap(handle_T) window_handles INIT(= MAP_INIT); +EXTERN PMap(handle_T) tabpage_handles INIT(= MAP_INIT); + +#define handle_get_buffer(h) pmap_get(handle_T)(&buffer_handles, (h)) +#define handle_get_window(h) pmap_get(handle_T)(&window_handles, (h)) +#define handle_get_tabpage(h) pmap_get(handle_T)(&tabpage_handles, (h)) + /// Structure used for saving state for :try /// /// Used when caller is supposed to be operating when other VimL code is being -- cgit