mirror of
https://github.com/neovim/neovim.git
synced 2025-09-07 11:58:17 +00:00
refactor(map): remove extra-allocating map_new/map_free functions
Note: the reason for removing them is not that there after this refactor is no use of them, but rather that having them available is an anti-pattern: they manange an _extra_ heap allocation which has nothing to do with the functionality of the map itself (khash manages the real buffers internally). In case there happens to be a reason to allocate the map structure itself later, this should be made explicit using xcalloc/xfree calls.
This commit is contained in:
@@ -63,7 +63,7 @@ void api_vim_free_all_mem(void)
|
||||
{
|
||||
String name;
|
||||
handle_T id;
|
||||
map_foreach((&namespace_ids), name, id, {
|
||||
map_foreach(&namespace_ids, name, id, {
|
||||
(void)id;
|
||||
xfree(name.data);
|
||||
})
|
||||
@@ -1584,7 +1584,7 @@ Dictionary nvim_get_namespaces(void)
|
||||
String name;
|
||||
handle_T id;
|
||||
|
||||
map_foreach((&namespace_ids), name, id, {
|
||||
map_foreach(&namespace_ids, name, id, {
|
||||
PUT(retval, name.data, INTEGER_OBJ(id));
|
||||
})
|
||||
|
||||
|
Reference in New Issue
Block a user