aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/channel.h
diff options
context:
space:
mode:
authorBjörn Linse <bjorn.linse@gmail.com>2021-08-22 16:03:21 +0200
committerBjörn Linse <bjorn.linse@gmail.com>2021-08-22 16:15:38 +0200
commitde21e6ef3d9af96d2b71e54d8148d28b5fc9f22e (patch)
treedc153c0cf6ac08e6f0f5508dcc2603618f314ef6 /src/nvim/channel.h
parentdb1b0ee3b30fd4cd323907c7f24bd575c22e68f0 (diff)
downloadrneovim-de21e6ef3d9af96d2b71e54d8148d28b5fc9f22e.tar.gz
rneovim-de21e6ef3d9af96d2b71e54d8148d28b5fc9f22e.tar.bz2
rneovim-de21e6ef3d9af96d2b71e54d8148d28b5fc9f22e.zip
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.
Diffstat (limited to 'src/nvim/channel.h')
-rw-r--r--src/nvim/channel.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/nvim/channel.h b/src/nvim/channel.h
index df858e1602..9bc0df3615 100644
--- a/src/nvim/channel.h
+++ b/src/nvim/channel.h
@@ -89,7 +89,7 @@ struct Channel {
bool callback_scheduled;
};
-EXTERN PMap(uint64_t) *channels INIT(= NULL);
+EXTERN PMap(uint64_t) channels INIT(= MAP_INIT);
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "channel.h.generated.h"
@@ -98,7 +98,7 @@ EXTERN PMap(uint64_t) *channels INIT(= NULL);
/// @returns Channel with the id or NULL if not found
static inline Channel *find_channel(uint64_t id)
{
- return pmap_get(uint64_t)(channels, id);
+ return pmap_get(uint64_t)(&channels, id);
}
static inline Stream *channel_instream(Channel *chan)