diff options
author | zeertzjq <zeertzjq@outlook.com> | 2024-11-01 17:34:19 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-01 09:34:19 +0000 |
commit | cbd8b2c1622e0c1cb4d38b65730e259eb6c100df (patch) | |
tree | 3300c416bd92aa912fcb2084853130d1f758331e /src/nvim/api/private/helpers.h | |
parent | 9b357e30fdd0a575480182872331fdb87e9cc331 (diff) | |
download | rneovim-cbd8b2c1622e0c1cb4d38b65730e259eb6c100df.tar.gz rneovim-cbd8b2c1622e0c1cb4d38b65730e259eb6c100df.tar.bz2 rneovim-cbd8b2c1622e0c1cb4d38b65730e259eb6c100df.zip |
vim-patch:9.1.0824: too many strlen() calls in register.c (#31022)
Problem: too many strlen() calls in register.c
Solution: refactor code, add string_T struct to keep track
of string lengths (John Marriott)
closes: vim/vim#15952
https://github.com/vim/vim/commit/79f6ffd388299ef3b1c95cbe658785e6e66df144
Co-authored-by: John Marriott <basilisk@internode.on.net>
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 57932e067e..d06f5c9c65 100644 --- a/src/nvim/api/private/helpers.h +++ b/src/nvim/api/private/helpers.h @@ -111,6 +111,12 @@ typedef kvec_withinit_t(Object, 16) ArrayBuilder; #define STATIC_CSTR_AS_OBJ(s) STRING_OBJ(STATIC_CSTR_AS_STRING(s)) #define STATIC_CSTR_TO_OBJ(s) STRING_OBJ(STATIC_CSTR_TO_STRING(s)) +#define API_CLEAR_STRING(s) \ + do { \ + XFREE_CLEAR(s.data); \ + s.size = 0; \ + } while (0) + // Helpers used by the generated msgpack-rpc api wrappers #define api_init_boolean #define api_init_integer |