summaryrefslogtreecommitdiff
path: root/utf8.c
diff options
context:
space:
mode:
authordjm@openbsd.org <djm@openbsd.org>2020-04-03 02:25:21 +0000
committerDamien Miller <djm@mindrot.org>2020-04-03 13:32:50 +1100
commitaf628b8a6c3ef403644d83d205c80ff188c97f0c (patch)
treeb1cb69480db2ae4637976f4a91cd6f3cfb0718db /utf8.c
parentd8ac9af645f5519ac5211e9e1e4dc1ed00e9cced (diff)
upstream: add allocating variant of the safe utf8 printer; ok
dtucker as part of a larger diff OpenBSD-Commit-ID: 037e2965bd50eacc2ffb49889ecae41552744fa0
Diffstat (limited to 'utf8.c')
-rw-r--r--utf8.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/utf8.c b/utf8.c
index b3d30047..f8340199 100644
--- a/utf8.c
+++ b/utf8.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: utf8.c,v 1.9 2020/03/06 18:12:55 markus Exp $ */
+/* $OpenBSD: utf8.c,v 1.10 2020/04/03 02:25:21 djm Exp $ */
/*
* Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org>
*
@@ -255,6 +255,20 @@ snmprintf(char *str, size_t sz, int *wp, const char *fmt, ...)
return ret;
}
+int
+asmprintf(char **outp, size_t sz, int *wp, const char *fmt, ...)
+{
+ va_list ap;
+ int ret;
+
+ *outp = NULL;
+ va_start(ap, fmt);
+ ret = vasnmprintf(outp, sz, wp, fmt, ap);
+ va_end(ap);
+
+ return ret;
+}
+
/*
* To stay close to the standard interfaces, the following functions
* return the number of non-NUL bytes written.