projects
/
musl
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
optimize nop case of wmemmove
[musl]
/
src
/
stdio
/
vfscanf.c
diff --git
a/src/stdio/vfscanf.c
b/src/stdio/vfscanf.c
index
bb92848
..
9e030fc
100644
(file)
--- a/
src/stdio/vfscanf.c
+++ b/
src/stdio/vfscanf.c
@@
-5,10
+5,7
@@
#include <wctype.h>
#include <limits.h>
#include <string.h>
#include <wctype.h>
#include <limits.h>
#include <string.h>
-#include <errno.h>
-#include <math.h>
-#include <float.h>
-#include <inttypes.h>
+#include <stdint.h>
#include "stdio_impl.h"
#include "shgetc.h"
#include "stdio_impl.h"
#include "shgetc.h"
@@
-81,6
+78,8
@@
int vfscanf(FILE *restrict f, const char *restrict fmt, va_list ap)
for (p=(const unsigned char *)fmt; *p; p++) {
for (p=(const unsigned char *)fmt; *p; p++) {
+ alloc = 0;
+
if (isspace(*p)) {
while (isspace(p[1])) p++;
shlim(f, 0);
if (isspace(*p)) {
while (isspace(p[1])) p++;
shlim(f, 0);
@@
-90,15
+89,19
@@
int vfscanf(FILE *restrict f, const char *restrict fmt, va_list ap)
continue;
}
if (*p != '%' || p[1] == '%') {
continue;
}
if (*p != '%' || p[1] == '%') {
- p += *p=='%';
shlim(f, 0);
shlim(f, 0);
- c = shgetc(f);
+ if (*p == '%') {
+ p++;
+ while (isspace((c=shgetc(f))));
+ } else {
+ c = shgetc(f);
+ }
if (c!=*p) {
shunget(f);
if (c<0) goto input_fail;
goto match_fail;
}
if (c!=*p) {
shunget(f);
if (c<0) goto input_fail;
goto match_fail;
}
- pos
++
;
+ pos
+= shcnt(f)
;
continue;
}
continue;
}
@@
-116,6
+119,8
@@
int vfscanf(FILE *restrict f, const char *restrict fmt, va_list ap)
}
if (*p=='m') {
}
if (*p=='m') {
+ wcs = 0;
+ s = 0;
alloc = !!dest;
p++;
} else {
alloc = !!dest;
p++;
} else {
@@
-327,3
+332,5
@@
match_fail:
FUNLOCK(f);
return matches;
}
FUNLOCK(f);
return matches;
}
+
+weak_alias(vfscanf,__isoc99_vfscanf);