0
0
mirror of https://github.com/vim/vim.git synced 2025-09-26 04:04: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

@@ -5087,13 +5087,12 @@ typedef struct {
// 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)}}