X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=src%2Fstdio%2Fvfprintf.c;h=50fb55c16149ed1166ff86077acf650f1efe721a;hb=2fab90a71acd3698954c08b9062db67188443dd7;hp=60da14d88a2da90871dbd8978315fbcd23a45f44;hpb=51ab6db4ed115d079d7131975e4adb074ba9ef9d;p=musl diff --git a/src/stdio/vfprintf.c b/src/stdio/vfprintf.c index 60da14d8..50fb55c1 100644 --- a/src/stdio/vfprintf.c +++ b/src/stdio/vfprintf.c @@ -4,6 +4,7 @@ #include #include #include +#include #include #include #include @@ -26,14 +27,6 @@ #define FLAGMASK (ALT_FORM|ZERO_PAD|LEFT_ADJ|PAD_POS|MARK_POS|GROUPED) -#if UINT_MAX == ULONG_MAX -#define LONG_IS_INT -#endif - -#if SIZE_MAX != ULONG_MAX || UINTMAX_MAX != ULLONG_MAX -#define ODD_TYPES -#endif - /* State machine to accept length modifiers + conversion specifiers. * Result is 0 on failure, or an argument type to pop on success. */ @@ -42,23 +35,9 @@ enum { ZTPRE, JPRE, STOP, PTR, INT, UINT, ULLONG, -#ifndef LONG_IS_INT LONG, ULONG, -#else -#define LONG INT -#define ULONG UINT -#endif SHORT, USHORT, CHAR, UCHAR, -#ifdef ODD_TYPES LLONG, SIZET, IMAX, UMAX, PDIFF, UIPTR, -#else -#define LLONG ULLONG -#define SIZET ULONG -#define IMAX LLONG -#define UMAX ULLONG -#define PDIFF LONG -#define UIPTR ULONG -#endif DBL, LDBL, NOARG, MAXSTATE @@ -128,29 +107,23 @@ union arg static void pop_arg(union arg *arg, int type, va_list *ap) { - /* Give the compiler a hint for optimizing the switch. */ - if ((unsigned)type > MAXSTATE) return; switch (type) { case PTR: arg->p = va_arg(*ap, void *); break; case INT: arg->i = va_arg(*ap, int); break; case UINT: arg->i = va_arg(*ap, unsigned int); -#ifndef LONG_IS_INT break; case LONG: arg->i = va_arg(*ap, long); break; case ULONG: arg->i = va_arg(*ap, unsigned long); -#endif break; case ULLONG: arg->i = va_arg(*ap, unsigned long long); break; case SHORT: arg->i = (short)va_arg(*ap, int); break; case USHORT: arg->i = (unsigned short)va_arg(*ap, int); break; case CHAR: arg->i = (signed char)va_arg(*ap, int); break; case UCHAR: arg->i = (unsigned char)va_arg(*ap, int); -#ifdef ODD_TYPES break; case LLONG: arg->i = va_arg(*ap, long long); break; case SIZET: arg->i = va_arg(*ap, size_t); break; case IMAX: arg->i = va_arg(*ap, intmax_t); break; case UMAX: arg->i = va_arg(*ap, uintmax_t); break; case PDIFF: arg->i = va_arg(*ap, ptrdiff_t); break; case UIPTR: arg->i = (uintptr_t)va_arg(*ap, void *); -#endif break; case DBL: arg->f = va_arg(*ap, double); break; case LDBL: arg->f = va_arg(*ap, long double); } @@ -586,7 +559,7 @@ static int printf_core(FILE *f, const char *fmt, va_list *ap, union arg *nl_arg, if (0) { case 'o': a = fmt_o(arg.i, z); - if ((fl&ALT_FORM) && p=0) fl &= ~ZERO_PAD; + if (xp) fl &= ~ZERO_PAD; if (!arg.i && !p) { a=z; break;