mirror of
https://github.com/neovim/neovim.git
synced 2025-10-04 17:06:30 +00:00
vim-patch:9.1.0409: too many strlen() calls in the regexp engine (#28857)
Problem: too many strlen() calls in the regexp engine
Solution: refactor code to retrieve strlen differently, make use
of bsearch() for getting the character class
(John Marriott)
closes: vim/vim#14648
82792db631
Cherry-pick keyvalue_T and its comparison functions from patch 9.1.0256.
vim-patch:9.1.0410: warning about uninitialized variable
vim-patch:9.1.0412: typo in regexp_bt.c in DEBUG code
Co-authored-by: John Marriott <basilisk@internode.on.net>
This commit is contained in:
@@ -32,6 +32,18 @@ static inline char *strappend(char *const dst, const char *const src)
|
||||
|
||||
typedef kvec_t(char) StringBuilder;
|
||||
|
||||
// Return the length of a string literal
|
||||
#define STRLEN_LITERAL(s) (sizeof(s) - 1)
|
||||
|
||||
/// Store a key/value pair
|
||||
typedef struct {
|
||||
int key; ///< the key
|
||||
char *value; ///< the value string
|
||||
size_t length; ///< length of the value string
|
||||
} keyvalue_T;
|
||||
|
||||
#define KEYVALUE_ENTRY(k, v) { (k), (v), STRLEN_LITERAL(v) }
|
||||
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
# include "strings.h.generated.h"
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user