summaryrefslogtreecommitdiffstats
path: root/src/structs.h
diff options
context:
space:
mode:
authorJohn Marriott <basilisk@internode.on.net>2024-04-02 20:26:01 +0200
committerChristian Brabandt <cb@256bit.org>2024-04-02 20:26:01 +0200
commit78d742ab8845578f78039ddd71a6444c6929257c (patch)
treed782bcc5d36c4259b05f29fe1d41e1845c9578e2 /src/structs.h
parent16cdfa69e07190674a8e85a48144a467472ca2f4 (diff)
patch 9.1.0256: Finding autocmd events is inefficientv9.1.0256
Problem: Finding autocmd events is inefficient Solution: Use binary search to find events, cache last found events, avoid use of strlen(), add SessionWritePost autocmd, fix test_codestyle and avoid endless loop (John Marriott) closes: #14287 Signed-off-by: John Marriott <basilisk@internode.on.net> Signed-off-by: Christian Brabandt <cb@256bit.org>
Diffstat (limited to 'src/structs.h')
-rw-r--r--src/structs.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/structs.h b/src/structs.h
index 2218de7037..3ce13ff0fb 100644
--- a/src/structs.h
+++ b/src/structs.h
@@ -5060,3 +5060,18 @@ typedef struct {
linenr_T spv_capcol_lnum; // line number for "cap_col"
#endif
} spellvars_T;
+
+// 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)}
+