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/regexp.c b/src/regexp.c
index b020a43..ea6079b 100644
--- a/src/regexp.c
+++ b/src/regexp.c
@@ -265,8 +265,8 @@
static keyvalue_T *last_entry = NULL;
target.key = 0;
- target.value = (char *)*pp + 2;
- target.length = 0; // not used, see cmp_keyvalue_value_n()
+ target.value.string = *pp + 2;
+ target.value.length = 0; // not used, see cmp_keyvalue_value_n()
if (last_entry != NULL && cmp_keyvalue_value_n(&target, last_entry) == 0)
entry = last_entry;
@@ -277,7 +277,7 @@
if (entry != NULL)
{
last_entry = entry;
- *pp += entry->length + 2;
+ *pp += entry->value.length + 2;
return entry->key;
}
}