0
0
mirror of https://github.com/vim/vim.git synced 2025-10-01 04:54:07 -04:00

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>
This commit is contained in:
John Marriott
2024-11-02 15:59:01 +01:00
committed by Christian Brabandt
parent f1d83c4c71
commit 8d4477ef22
9 changed files with 76 additions and 55 deletions

View File

@@ -9530,14 +9530,16 @@ find_cmdline_var(char_u *src, size_t *usedlen)
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: