projects
/
musl
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
setjmp: optimize x86 longjmp epilogues
[musl]
/
src
/
stdio
/
vfwprintf.c
diff --git
a/src/stdio/vfwprintf.c
b/src/stdio/vfwprintf.c
index
1e6e47c
..
85b036c
100644
(file)
--- a/
src/stdio/vfwprintf.c
+++ b/
src/stdio/vfwprintf.c
@@
-5,6
+5,7
@@
#include <string.h>
#include <stdarg.h>
#include <stddef.h>
#include <string.h>
#include <stdarg.h>
#include <stddef.h>
+#include <stdlib.h>
#include <wchar.h>
#include <inttypes.h>
#include <wchar.h>
#include <inttypes.h>
@@
-52,6
+53,8
@@
static const unsigned char states[]['z'-'A'+1] = {
}, { /* 1: l-prefixed */
S('d') = LONG, S('i') = LONG,
S('o') = ULONG, S('u') = ULONG, S('x') = ULONG, S('X') = ULONG,
}, { /* 1: l-prefixed */
S('d') = LONG, S('i') = LONG,
S('o') = ULONG, S('u') = ULONG, S('x') = ULONG, S('X') = ULONG,
+ S('e') = DBL, S('f') = DBL, S('g') = DBL, S('a') = DBL,
+ S('E') = DBL, S('F') = DBL, S('G') = DBL, S('A') = DBL,
S('c') = INT, S('s') = PTR, S('n') = PTR,
S('l') = LLPRE,
}, { /* 2: ll-prefixed */
S('c') = INT, S('s') = PTR, S('n') = PTR,
S('l') = LLPRE,
}, { /* 2: ll-prefixed */
@@
-98,8
+101,6
@@
union arg
static void pop_arg(union arg *arg, int type, va_list *ap)
{
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);
switch (type) {
case PTR: arg->p = va_arg(*ap, void *);
break; case INT: arg->i = va_arg(*ap, int);
@@
-257,8
+258,11
@@
static int wprintf_core(FILE *f, const wchar_t *fmt, va_list *ap, union arg *nl_
}
continue;
case 'c':
}
continue;
case 'c':
+ if (w<1) w=1;
+ if (w>1 && !(fl&LEFT_ADJ)) fprintf(f, "%*s", w-1, "");
fputwc(btowc(arg.i), f);
fputwc(btowc(arg.i), f);
- l = 1;
+ if (w>1 && (fl&LEFT_ADJ)) fprintf(f, "%*s", w-1, "");
+ l = w;
continue;
case 'C':
fputwc(arg.i, f);
continue;
case 'C':
fputwc(arg.i, f);