patch 9.1.0828: string_T struct could be used more often
Problem: string_T struct could be used more often
Solution: Refactor code and make use of string_T struct
for key-value pairs, reformat overlong lines
(John Marriott)
closes: #15975
Signed-off-by: John Marriott <basilisk@internode.on.net>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/src/structs.h b/src/structs.h
index d112796..33367f0 100644
--- a/src/structs.h
+++ b/src/structs.h
@@ -5087,13 +5087,12 @@
// Return the length of a string literal
#define STRLEN_LITERAL(s) (sizeof(s) - 1)
-// Store a key/value pair
+// Store a key/value (string) pair
typedef struct
{
int key; // the key
- char *value; // the value string
- size_t length; // length of the value string
+ string_T value; // the value
} keyvalue_T;
#define KEYVALUE_ENTRY(k, v) \
- {(k), (v), STRLEN_LITERAL(v)}
+ {(k), {((char_u *)v), STRLEN_LITERAL(v)}}