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/ex_docmd.c b/src/ex_docmd.c
index 807b470..d60e344 100644
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -9530,14 +9530,16 @@
case '<':
target.key = 0;
- target.value = (char *)src + 1; // skip over '<'
- target.length = 0; // not used, see cmp_keyvalue_value_n()
+ target.value.string = src + 1; // skip over '<'
+ target.value.length = 0; // not used, see cmp_keyvalue_value_n()
- entry = (keyvalue_T *)bsearch(&target, &spec_str_tab, ARRAY_LENGTH(spec_str_tab), sizeof(spec_str_tab[0]), cmp_keyvalue_value_n);
+ entry = (keyvalue_T *)bsearch(&target, &spec_str_tab,
+ ARRAY_LENGTH(spec_str_tab), sizeof(spec_str_tab[0]),
+ cmp_keyvalue_value_n);
if (entry == NULL)
return -1;
- *usedlen = entry->length + 1;
+ *usedlen = entry->value.length + 1;
return entry->key;
default: