]> git.ipfire.org Git - thirdparty/openssh-portable.git/commitdiff
upstream: add allocating variant of the safe utf8 printer; ok
authordjm@openbsd.org <djm@openbsd.org>
Fri, 3 Apr 2020 02:25:21 +0000 (02:25 +0000)
committerDamien Miller <djm@mindrot.org>
Fri, 3 Apr 2020 02:32:50 +0000 (13:32 +1100)
dtucker as part of a larger diff

OpenBSD-Commit-ID: 037e2965bd50eacc2ffb49889ecae41552744fa0

utf8.c
utf8.h

diff --git a/utf8.c b/utf8.c
index b3d30047827ac8c384b6dc6487523da4e30f06c9..f83401996b7e0bdb8c794d341f298430af65795a 100644 (file)
--- 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.
diff --git a/utf8.h b/utf8.h
index 88c5a34a3436b47120a5ff9e0ebe6c29513e7310..20a11dc59d8fc2ebd473bcfcc77daa5db6866223 100644 (file)
--- a/utf8.h
+++ b/utf8.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: utf8.h,v 1.1 2016/05/25 23:48:45 schwarze Exp $ */
+/* $OpenBSD: utf8.h,v 1.2 2020/04/03 02:25:21 djm Exp $ */
 /*
  * Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org>
  *
@@ -22,4 +22,6 @@ int    fmprintf(FILE *, const char *, ...)
 int     vfmprintf(FILE *, const char *, va_list);
 int     snmprintf(char *, size_t, int *, const char *, ...)
             __attribute__((format(printf, 4, 5)));
+int     asmprintf(char **, size_t, int *, const char *, ...)
+            __attribute__((format(printf, 4, 5)));
 void    msetlocale(void);