diff --git a/libc/upstream-openbsd/lib/libc/stdio/vfwprintf.c b/libc/upstream-openbsd/lib/libc/stdio/vfwprintf.c
index f76eed3e24c48013ef69a6fc9973b80a108916f2..a6f41232c53bbc9059ef1df1c409d60d18d44122 100644 (file)
-/* $OpenBSD: vfwprintf.c,v 1.6 2013/04/17 17:40:35 tedu Exp $ */
+/* $OpenBSD: vfwprintf.c,v 1.12 2014/12/21 00:23:30 daniel Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
#include "local.h"
#include "fvwrite.h"
-wint_t __fputwc_unlock(wchar_t wc, FILE *fp);
-
union arg {
int intarg;
unsigned int uintarg;
#include <locale.h>
#include <math.h>
#include "floatio.h"
+#include "gdtoa.h"
#define DEFPREC 6
-extern char *__dtoa(double, int, int, int *, int *, char **);
-extern void __freedtoa(char *);
static int exponent(wchar_t *, int, int);
#endif /* FLOATING_POINT */
@@ -327,9 +324,6 @@ __vfwprintf(FILE * __restrict fp, const wchar_t * __restrict fmt0, __va_list ap)
int realsz; /* field size expanded by dprec */
int size; /* size of converted field or string */
const char *xdigs; /* digits for %[xX] conversion */
-#define NIOV 8
- struct __suio uio; /* output information: summary */
- struct __siov iov[NIOV];/* ... and individual io vectors */
wchar_t buf[BUF]; /* buffer with space for digits of uintmax_t */
wchar_t ox[2]; /* space for 0x; ox[1] is either x, X, or \0 */
union arg *argtable; /* args, built due to positional arg */
@@ -392,7 +386,7 @@ __vfwprintf(FILE * __restrict fp, const wchar_t * __restrict fmt0, __va_list ap)
flags&PTRINT ? GETARG(ptrdiff_t) : \
flags&SIZEINT ? GETARG(ssize_t) : \
flags&SHORTINT ? (short)GETARG(int) : \
- flags&CHARINT ? (__signed char)GETARG(int) : \
+ flags&CHARINT ? (signed char)GETARG(int) : \
GETARG(int)))
#define UARG() \
((uintmax_t)(flags&MAXINT ? GETARG(uintmax_t) : \
@@ -466,9 +460,6 @@ __vfwprintf(FILE * __restrict fp, const wchar_t * __restrict fmt0, __va_list ap)
argtable = NULL;
nextarg = 1;
va_copy(orgap, ap);
- uio.uio_iov = iov;
- uio.uio_resid = 0;
- uio.uio_iovcnt = 0;
ret = 0;
convbuf = NULL;
if (signflag)
sign = '-';
if (expt == INT_MAX) { /* inf or nan */
- if (*cp == 'N') {
+ if (*cp == 'N')
cp = (ch >= 'a') ? L"nan" : L"NAN";
- sign = '\0';
- } else
+ else
cp = (ch >= 'a') ? L"inf" : L"INF";
size = 3;
flags &= ~ZEROPAD;
}
break;
#endif /* FLOATING_POINT */
+#ifndef NO_PRINTF_PERCENT_N
case 'n':
if (flags & LLONGINT)
*GETARG(long long *) = ret;
else if (flags & SHORTINT)
*GETARG(short *) = ret;
else if (flags & CHARINT)
- *GETARG(__signed char *) = ret;
+ *GETARG(signed char *) = ret;
else if (flags & PTRINT)
*GETARG(ptrdiff_t *) = ret;
else if (flags & SIZEINT)
else
*GETARG(int *) = ret;
continue; /* no output */
+#endif /* NO_PRINTF_PERCENT_N */
case 'O':
flags |= LONGINT;
/*FALLTHROUGH*/
ADDTYPE(T_DOUBLE);
break;
#endif /* FLOATING_POINT */
+#ifndef NO_PRINTF_PERCENT_N
case 'n':
if (flags & LLONGINT)
ADDTYPE(TP_LLONG);
else
ADDTYPE(TP_INT);
continue; /* no output */
+#endif /* NO_PRINTF_PERCENT_N */
case 'O':
flags |= LONGINT;
/*FALLTHROUGH*/