summaryrefslogtreecommitdiff
path: root/src/stdio/vfprintf_s.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/stdio/vfprintf_s.c')
-rw-r--r--src/stdio/vfprintf_s.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/src/stdio/vfprintf_s.c b/src/stdio/vfprintf_s.c
index f6b8c334..5c2b4b9d 100644
--- a/src/stdio/vfprintf_s.c
+++ b/src/stdio/vfprintf_s.c
@@ -5,16 +5,11 @@
/** write formatted output to a file stream **/
int vfprintf_s(FILE * restrict stream, const char * restrict format, va_list arg)
{
- __C_EXT(1, 201112L);
- va_list ap;
- va_copy(ap, arg);
- int len = vsnprintf(NULL, 0, format, arg);
- char *buf = malloc(len + 1);
- 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);
}
/***