diff options
| author | bfredl <bjorn.linse@gmail.com> | 2023-05-17 13:00:32 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-05-17 13:00:32 +0200 |
| commit | 67176c3f20cf8f0b6c7d7c4d75093ea6b7c00b74 (patch) | |
| tree | c1a0e185985227f05f1da2480de74739c779dfaf /src/nvim/lua | |
| parent | 189fb6203262340e7a59e782be970bcd8ae28e61 (diff) | |
| parent | e2fdd53d8c015913e8be4ff708fc3488558c8906 (diff) | |
| download | rneovim-67176c3f20cf8f0b6c7d7c4d75093ea6b7c00b74.tar.gz rneovim-67176c3f20cf8f0b6c7d7c4d75093ea6b7c00b74.tar.bz2 rneovim-67176c3f20cf8f0b6c7d7c4d75093ea6b7c00b74.zip | |
Merge pull request #15534 from bfredl/monomap
refactor(map): avoid duplicated khash_t implementations for values and support sets
Diffstat (limited to 'src/nvim/lua')
| -rw-r--r-- | src/nvim/lua/executor.c | 6 | ||||
| -rw-r--r-- | src/nvim/lua/executor.h | 2 | ||||
| -rw-r--r-- | src/nvim/lua/treesitter.c | 6 |
3 files changed, 7 insertions, 7 deletions
diff --git a/src/nvim/lua/executor.c b/src/nvim/lua/executor.c index 9586b56f3c..1d11379956 100644 --- a/src/nvim/lua/executor.c +++ b/src/nvim/lua/executor.c @@ -910,7 +910,7 @@ static void nlua_common_free_all_mem(lua_State *lstate) if (nlua_track_refs) { // in case there are leaked luarefs, leak the associated memory // to get LeakSanitizer stacktraces on exit - pmap_destroy(handle_T)(&ref_state->ref_markers); + map_destroy(int, &ref_state->ref_markers); } #endif @@ -1285,7 +1285,7 @@ LuaRef nlua_ref(lua_State *lstate, nlua_ref_state_t *ref_state, int index) #ifdef NLUA_TRACK_REFS if (nlua_track_refs) { // dummy allocation to make LeakSanitizer track our luarefs - pmap_put(handle_T)(&ref_state->ref_markers, ref, xmalloc(3)); + pmap_put(int)(&ref_state->ref_markers, ref, xmalloc(3)); } #endif } @@ -1305,7 +1305,7 @@ void nlua_unref(lua_State *lstate, nlua_ref_state_t *ref_state, LuaRef ref) #ifdef NLUA_TRACK_REFS // NB: don't remove entry from map to track double-unref if (nlua_track_refs) { - xfree(pmap_get(handle_T)(&ref_state->ref_markers, ref)); + xfree(pmap_get(int)(&ref_state->ref_markers, ref)); } #endif luaL_unref(lstate, LUA_REGISTRYINDEX, ref); diff --git a/src/nvim/lua/executor.h b/src/nvim/lua/executor.h index 7e16c0f45c..f340d9d0d8 100644 --- a/src/nvim/lua/executor.h +++ b/src/nvim/lua/executor.h @@ -24,7 +24,7 @@ typedef struct { LuaRef empty_dict_ref; int ref_count; #if __has_feature(address_sanitizer) - PMap(handle_T) ref_markers; + PMap(int) ref_markers; #endif } nlua_ref_state_t; diff --git a/src/nvim/lua/treesitter.c b/src/nvim/lua/treesitter.c index 96e104cd48..a9e7838980 100644 --- a/src/nvim/lua/treesitter.c +++ b/src/nvim/lua/treesitter.c @@ -241,9 +241,9 @@ int tslua_remove_lang(lua_State *L) const char *lang_name = luaL_checkstring(L, 1); bool present = pmap_has(cstr_t)(&langs, lang_name); if (present) { - char *key = (char *)pmap_key(cstr_t)(&langs, lang_name); - pmap_del(cstr_t)(&langs, lang_name); - xfree(key); + cstr_t key; + pmap_del(cstr_t)(&langs, lang_name, &key); + xfree((void *)key); } lua_pushboolean(L, present); return 1; |