1
0
Fork 0
mirror of git://git.gnupg.org/gnupg.git synced 2025-07-03 22:56:33 +02:00

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.
This commit is contained in:
Werner Koch 2022-03-18 13:47:10 +01:00
parent 8631d4cfe2
commit 449d2fbcde
No known key found for this signature in database
GPG key ID: E3FDFF218E45B72B
4 changed files with 86 additions and 5 deletions

View file

@ -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)