diff options
Diffstat (limited to 'newlib/libc/stdio/vsnprintf.c')
-rw-r--r-- | newlib/libc/stdio/vsnprintf.c | 28 |
1 files changed, 3 insertions, 25 deletions
diff --git a/newlib/libc/stdio/vsnprintf.c b/newlib/libc/stdio/vsnprintf.c index e935b49c1..6a26f8bea 100644 --- a/newlib/libc/stdio/vsnprintf.c +++ b/newlib/libc/stdio/vsnprintf.c @@ -24,11 +24,7 @@ static char sccsid[] = "%W% (Berkeley) %G%"; #include <reent.h> #include <stdio.h> #include <limits.h> -#ifdef _HAVE_STDC #include <stdarg.h> -#else -#include <varargs.h> -#endif #include <errno.h> #ifndef _REENT_ONLY @@ -37,28 +33,10 @@ int _DEFUN(vsnprintf, (str, size, fmt, ap), char *str _AND size_t size _AND - _CONST char *fmt _AND + const char *fmt _AND va_list ap) { - int ret; - FILE f; - struct _reent *ptr = _REENT; - - if (size > INT_MAX) - { - ptr->_errno = EOVERFLOW; - return EOF; - } - f._flags = __SWR | __SSTR; - f._bf._base = f._p = (unsigned char *) str; - f._bf._size = f._w = (size > 0 ? size - 1 : 0); - f._file = -1; /* No file. */ - ret = _vfprintf_r (ptr, &f, fmt, ap); - if (ret < EOF) - ptr->_errno = EOVERFLOW; - if (size > 0) - *f._p = 0; - return ret; + return _vsnprintf_r (_REENT, str, size, fmt, ap); } #endif /* !_REENT_ONLY */ @@ -68,7 +46,7 @@ _DEFUN(_vsnprintf_r, (ptr, str, size, fmt, ap), struct _reent *ptr _AND char *str _AND size_t size _AND - _CONST char *fmt _AND + const char *fmt _AND va_list ap) { int ret; |