diff options
author | djm@openbsd.org <djm@openbsd.org> | 2020-04-03 02:25:21 +0000 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2020-04-03 13:32:50 +1100 |
commit | af628b8a6c3ef403644d83d205c80ff188c97f0c (patch) | |
tree | b1cb69480db2ae4637976f4a91cd6f3cfb0718db /utf8.c | |
parent | d8ac9af645f5519ac5211e9e1e4dc1ed00e9cced (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.c | 16 |
1 files changed, 15 insertions, 1 deletions
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: utf8.c,v 1.9 2020/03/06 18:12:55 markus Exp $ */ | 1 | /* $OpenBSD: utf8.c,v 1.10 2020/04/03 02:25:21 djm Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> | 3 | * Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> |
4 | * | 4 | * |
@@ -255,6 +255,20 @@ snmprintf(char *str, size_t sz, int *wp, const char *fmt, ...) | |||
255 | return ret; | 255 | return ret; |
256 | } | 256 | } |
257 | 257 | ||
258 | int | ||
259 | asmprintf(char **outp, size_t sz, int *wp, const char *fmt, ...) | ||
260 | { | ||
261 | va_list ap; | ||
262 | int ret; | ||
263 | |||
264 | *outp = NULL; | ||
265 | va_start(ap, fmt); | ||
266 | ret = vasnmprintf(outp, sz, wp, fmt, ap); | ||
267 | va_end(ap); | ||
268 | |||
269 | return ret; | ||
270 | } | ||
271 | |||
258 | /* | 272 | /* |
259 | * To stay close to the standard interfaces, the following functions | 273 | * To stay close to the standard interfaces, the following functions |
260 | * return the number of non-NUL bytes written. | 274 | * return the number of non-NUL bytes written. |