From 449d2fbcde630974628285d3405feb6ab2a812f9 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Fri, 18 Mar 2022 13:47:10 +0100 Subject: common: New function map_static_strings * common/mapstrings.c (struct intmapping_s): New. (map_static_strings): New. * common/stringhelp.c (do_strconcat): Rename to ... (vstrconcat): this and make global. * common/t-mapstrings.c (test_map_static_strings): New test. --- common/stringhelp.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'common/stringhelp.c') diff --git a/common/stringhelp.c b/common/stringhelp.c index c9e10800d..3e56d664d 100644 --- a/common/stringhelp.c +++ b/common/stringhelp.c @@ -1169,9 +1169,10 @@ try_percent_escape (const char *str, const char *extra) } - -static char * -do_strconcat (const char *s1, va_list arg_ptr) +/* Same as strconcat but takes a va_list. Returns EINVAL if the list + * is too long, all other errors are due to an ENOMEM condition. */ +char * +vstrconcat (const char *s1, va_list arg_ptr) { const char *argv[48]; size_t argc; @@ -1216,7 +1217,7 @@ strconcat (const char *s1, ...) else { va_start (arg_ptr, s1); - result = do_strconcat (s1, arg_ptr); + result = vstrconcat (s1, arg_ptr); va_end (arg_ptr); } return result; @@ -1235,7 +1236,7 @@ xstrconcat (const char *s1, ...) else { va_start (arg_ptr, s1); - result = do_strconcat (s1, arg_ptr); + result = vstrconcat (s1, arg_ptr); va_end (arg_ptr); } if (!result) -- cgit