diff options
Diffstat (limited to 'libc/stdio/vasprintf.c')
-rw-r--r-- | libc/stdio/vasprintf.c | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/libc/stdio/vasprintf.c b/libc/stdio/vasprintf.c index ca110cbd1..1c184583b 100644 --- a/libc/stdio/vasprintf.c +++ b/libc/stdio/vasprintf.c @@ -5,12 +5,11 @@ * Dedicated to Toni. See uClibc/DEDICATION.mjn3 for details. */ -#define open_memstream __open_memstream - #include "_stdio.h" #include <stdarg.h> #include <bits/uClibc_va_copy.h> + #ifdef __UCLIBC_MJN3_ONLY__ /* Do the memstream stuff inline to avoid fclose and the openlist? */ #warning CONSIDER: avoid open_memstream call? @@ -20,7 +19,15 @@ #warning Skipping vasprintf since no vsnprintf! #else -int attribute_hidden __vasprintf(char **__restrict buf, const char * __restrict format, +#ifdef __UCLIBC_HAS_GLIBC_CUSTOM_STREAMS__ +libc_hidden_proto(open_memstream) +libc_hidden_proto(fclose) +libc_hidden_proto(vfprintf) +#else +libc_hidden_proto(vsnprintf) +#endif + +int vasprintf(char **__restrict buf, const char * __restrict format, va_list arg) { #ifdef __UCLIBC_HAS_GLIBC_CUSTOM_STREAMS__ @@ -32,7 +39,7 @@ int attribute_hidden __vasprintf(char **__restrict buf, const char * __restrict *buf = NULL; if ((f = open_memstream(buf, &size)) != NULL) { - rv = __vfprintf(f, format, arg); + rv = vfprintf(f, format, arg); fclose(f); if (rv < 0) { free(*buf); @@ -54,14 +61,14 @@ int attribute_hidden __vasprintf(char **__restrict buf, const char * __restrict int rv; va_copy(arg2, arg); - rv = __vsnprintf(NULL, 0, format, arg2); + rv = vsnprintf(NULL, 0, format, arg2); va_end(arg2); *buf = NULL; if (rv >= 0) { if ((*buf = malloc(++rv)) != NULL) { - if ((rv = __vsnprintf(*buf, rv, format, arg)) < 0) { + if ((rv = vsnprintf(*buf, rv, format, arg)) < 0) { free(*buf); *buf = NULL; } @@ -74,6 +81,7 @@ int attribute_hidden __vasprintf(char **__restrict buf, const char * __restrict #endif /* __UCLIBC_HAS_GLIBC_CUSTOM_STREAMS__ */ } -strong_alias(__vasprintf,vasprintf) +libc_hidden_proto(vasprintf) +libc_hidden_def(vasprintf) #endif |