summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob Kaivo <jkk@ung.org>2024-01-31 03:19:41 -0500
committerJakob Kaivo <jkk@ung.org>2024-01-31 03:19:41 -0500
commit00e1809a223037c0a4bf6e34e68014982b8b6a1d (patch)
tree7865ee46a1c27b2efa345e8e9699083224bb0858
parentb59cf979a944e9ad19d654e9ac5e0d7b102799f0 (diff)
remove initialization of (possibly) VLA
-rw-r--r--src/stdio/__printf.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/stdio/__printf.c b/src/stdio/__printf.c
index 74499cae..72eb1585 100644
--- a/src/stdio/__printf.c
+++ b/src/stdio/__printf.c
@@ -1,6 +1,8 @@
#include <ctype.h>
#include <stdio.h>
#include <stddef.h>
+#include <stdlib.h>
+#include <wchar.h>
#ifdef _POSIX_SOURCE
#include <sys/types.h>
@@ -270,7 +272,8 @@ int (__printf)(struct io_options *opt, const char * format, va_list arg)
} else if (length == l) {
#if defined __STDC_VERSION__
wint_t wc = va_arg(arg, wint_t);
- char mb[MB_CUR_MAX + 1] = "WC";
+ char mb[MB_CUR_MAX + 1];
+ mb[0] = 'W'; mb[1] = 'C'; mb[2] = '\0';
wctomb(mb, wc);
nout = __append(s, mb, nout, n);
#else