From b01bb016a28296563cfddb5634726ed51fd720e0 Mon Sep 17 00:00:00 2001 From: Jakob Kaivo Date: Fri, 25 Sep 2020 13:30:56 -0400 Subject: get rid of malloc() where possible --- src/wchar/vfwprintf_s.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) (limited to 'src/wchar') diff --git a/src/wchar/vfwprintf_s.c b/src/wchar/vfwprintf_s.c index 74d0e106..cc72f88b 100644 --- a/src/wchar/vfwprintf_s.c +++ b/src/wchar/vfwprintf_s.c @@ -3,16 +3,11 @@ int vfwprintf_s(FILE * restrict stream, const wchar_t * restrict format, va_list arg) { - __C_EXT(1, 201112L); - va_list ap; - va_copy(ap, arg); - int len = vsnwprintf(NULL, 0, format, arg); - wchar_t *buf = malloc((len + 1) * sizeof(wchar_t)); - len = vsnprintf(buf, len, format, ap); - va_end(ap); - //len = (int)fwrite(buf, sizeof(*buf), len, stream); - free(buf); - return len; + struct io_options opt = { + .fnname = __func__, + .stream = stream, + }; + return __printf(&opt, format, arg); } /* -- cgit v1.2.1