aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/map.c
diff options
context:
space:
mode:
authorRom Grk <romgrk.cc@gmail.com>2020-11-03 03:11:08 -0500
committerRom Grk <romgrk.cc@gmail.com>2020-11-03 03:11:08 -0500
commit13e0ca3e194a438383b8451e19090355aa6c29dc (patch)
tree0ac33ef5ac829b7c74dd15f34b17540c3186c356 /src/nvim/map.c
parentc7c865214655f7d88fde85ed4947f07319c14182 (diff)
parent5b5848f2fb1f4b7995bb8a59d94b6766d2182070 (diff)
downloadrneovim-13e0ca3e194a438383b8451e19090355aa6c29dc.tar.gz
rneovim-13e0ca3e194a438383b8451e19090355aa6c29dc.tar.bz2
rneovim-13e0ca3e194a438383b8451e19090355aa6c29dc.zip
Merge branch 'master' into add-scroll-events
Diffstat (limited to 'src/nvim/map.c')
-rw-r--r--src/nvim/map.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/nvim/map.c b/src/nvim/map.c
index ca8ea76333..7d97b7f13d 100644
--- a/src/nvim/map.c
+++ b/src/nvim/map.c
@@ -12,6 +12,9 @@
#include <stdbool.h>
#include <string.h>
+#include <lua.h>
+#include <lauxlib.h>
+
#include "nvim/map.h"
#include "nvim/map_defs.h"
#include "nvim/vim.h"
@@ -173,6 +176,20 @@ static inline bool HlEntry_eq(HlEntry ae1, HlEntry ae2)
return memcmp(&ae1, &ae2, sizeof(ae1)) == 0;
}
+static inline khint_t ColorKey_hash(ColorKey ae)
+{
+ const uint8_t *data = (const uint8_t *)&ae;
+ khint_t h = 0;
+ for (size_t i = 0; i < sizeof(ae); i++) {
+ h = (h << 5) - h + data[i];
+ }
+ return h;
+}
+
+static inline bool ColorKey_eq(ColorKey ae1, ColorKey ae2)
+{
+ return memcmp(&ae1, &ae2, sizeof(ae1)) == 0;
+}
MAP_IMPL(int, int, DEFAULT_INITIALIZER)
@@ -191,6 +208,7 @@ MAP_IMPL(String, MsgpackRpcRequestHandler, MSGPACK_HANDLER_INITIALIZER)
MAP_IMPL(HlEntry, int, DEFAULT_INITIALIZER)
MAP_IMPL(String, handle_T, 0)
+MAP_IMPL(ColorKey, ColorItem, COLOR_ITEM_INITIALIZER)
/// Deletes a key:value pair from a string:pointer map, and frees the
/// storage of both key and value.