diff options
author | Björn Linse <bjorn.linse@gmail.com> | 2021-08-21 13:55:12 +0200 |
---|---|---|
committer | Björn Linse <bjorn.linse@gmail.com> | 2021-10-03 10:46:57 +0200 |
commit | 32565922efe0d1a6e8e4dddb23295d1a08670b54 (patch) | |
tree | 501dd50b3ae199e3b52071d66d307e9d69772f82 /src/nvim/api/private/helpers.h | |
parent | 9337fff8aad610acd5ef619f757686c47f0c118c (diff) | |
download | rneovim-32565922efe0d1a6e8e4dddb23295d1a08670b54.tar.gz rneovim-32565922efe0d1a6e8e4dddb23295d1a08670b54.tar.bz2 rneovim-32565922efe0d1a6e8e4dddb23295d1a08670b54.zip |
refactor(api): handle option dicts properly
Do not copy a lot of lua strings (dict keys) to just strequal() them
Just compare them directly to a dedicated hash function.
feat(generators): HASHY McHASHFACE
Diffstat (limited to 'src/nvim/api/private/helpers.h')
-rw-r--r-- | src/nvim/api/private/helpers.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/nvim/api/private/helpers.h b/src/nvim/api/private/helpers.h index ecce6afa26..2cdd80bffe 100644 --- a/src/nvim/api/private/helpers.h +++ b/src/nvim/api/private/helpers.h @@ -59,6 +59,9 @@ #define NIL ((Object)OBJECT_INIT) #define NULL_STRING ((String)STRING_INIT) +// currently treat key=vim.NIL as if the key was missing +#define HAS_KEY(o) ((o).type != kObjectTypeNil) + #define PUT(dict, k, v) \ kv_push(dict, ((KeyValuePair) { .key = cstr_to_string(k), .value = v })) @@ -138,6 +141,9 @@ typedef struct { } while (0) #ifdef INCLUDE_GENERATED_DECLARATIONS +# include "keysets.h.generated.h" # include "api/private/helpers.h.generated.h" #endif + + #endif // NVIM_API_PRIVATE_HELPERS_H |