diff options
Diffstat (limited to 'newlib/libc/stdio/vsniprintf.c')
-rw-r--r-- | newlib/libc/stdio/vsniprintf.c | 28 |
1 files changed, 3 insertions, 25 deletions
diff --git a/newlib/libc/stdio/vsniprintf.c b/newlib/libc/stdio/vsniprintf.c index 68f0c7f..5e40fdc 100644 --- a/newlib/libc/stdio/vsniprintf.c +++ b/newlib/libc/stdio/vsniprintf.c @@ -63,11 +63,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 @@ -76,28 +72,10 @@ int _DEFUN(vsniprintf, (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 = _vfiprintf_r (ptr, &f, fmt, ap); - if (ret < EOF) - ptr->_errno = EOVERFLOW; - if (size > 0) - *f._p = 0; - return ret; + return _vsniprintf_r (_REENT, str, size, fmt, ap); } #endif /* !_REENT_ONLY */ @@ -107,7 +85,7 @@ _DEFUN(_vsniprintf_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; |