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.
This commit is contained in:
Björn Linse
2021-08-22 11:25:59 +02:00
parent b888018aed
commit c265fd31ab
14 changed files with 19 additions and 84 deletions

View File

@@ -5,7 +5,7 @@
#include "nvim/autocmd.h"
#include "nvim/api/private/handle.h"
#include "nvim/api/private/helpers.h"
#include "nvim/ascii.h"
#include "nvim/buffer.h"
#include "nvim/charset.h"
@@ -1150,7 +1150,7 @@ void aucmd_prepbuf(aco_save_T *aco, buf_T *buf)
block_autocmds(); // We don't want BufEnter/WinEnter autocommands.
if (need_append) {
win_append(lastwin, aucmd_win);
handle_register_window(aucmd_win);
pmap_put(handle_T)(&window_handles, aucmd_win->handle, aucmd_win);
win_config_float(aucmd_win, aucmd_win->w_float_config);
}
// Prevent chdir() call in win_enter_ext(), through do_autochdir()
@@ -1191,7 +1191,7 @@ void aucmd_restbuf(aco_save_T *aco)
win_found:
win_remove(curwin, NULL);
handle_unregister_window(curwin);
pmap_del(handle_T)(&window_handles, curwin->handle);
if (curwin->w_grid_alloc.chars != NULL) {
ui_comp_remove_grid(&curwin->w_grid_alloc);
ui_call_win_hide(curwin->w_grid_alloc.handle);