aboutsummaryrefslogtreecommitdiffstats
path: root/common/stringhelp.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2022-03-18 12:47:10 +0000
committerWerner Koch <[email protected]>2022-03-18 13:14:39 +0000
commit449d2fbcde630974628285d3405feb6ab2a812f9 (patch)
treee2eef0f8d1ff5e68d3bacb5a8193829cb31333b1 /common/stringhelp.c
parentgpg: Allow decryption of symencr even for non-compliant cipher. (diff)
downloadgnupg-449d2fbcde630974628285d3405feb6ab2a812f9.tar.gz
gnupg-449d2fbcde630974628285d3405feb6ab2a812f9.zip
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.
Diffstat (limited to 'common/stringhelp.c')
-rw-r--r--common/stringhelp.c11
1 files changed, 6 insertions, 5 deletions
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)