diff options
author | ache <ache@FreeBSD.org> | 1997-04-04 18:28:38 +0000 |
---|---|---|
committer | ache <ache@FreeBSD.org> | 1997-04-04 18:28:38 +0000 |
commit | 3cb787be7f29abc29532318f58404d7918711354 (patch) | |
tree | cb57c6c5465282cb2e105a29e8ea1dd2f3e12881 /lib/libc/stdio/vfscanf.c | |
parent | 290a0d9360310ac92d01cfc64a53d6bf7ab7bdd1 (diff) | |
download | FreeBSD-src-3cb787be7f29abc29532318f58404d7918711354.zip FreeBSD-src-3cb787be7f29abc29532318f58404d7918711354.tar.gz |
Speedup in case locale not used
Diffstat (limited to 'lib/libc/stdio/vfscanf.c')
-rw-r--r-- | lib/libc/stdio/vfscanf.c | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/lib/libc/stdio/vfscanf.c b/lib/libc/stdio/vfscanf.c index 54cf776..cb66eb9 100644 --- a/lib/libc/stdio/vfscanf.c +++ b/lib/libc/stdio/vfscanf.c @@ -39,7 +39,7 @@ static char sccsid[] = "@(#)vfscanf.c 8.1 (Berkeley) 6/4/93"; #endif static const char rcsid[] = - "$Id: vfscanf.c,v 1.7 1997/02/22 15:02:41 peter Exp $"; + "$Id: vfscanf.c,v 1.8 1997/03/03 17:53:02 bde Exp $"; #endif /* LIBC_SCCS and not lint */ #include <stdio.h> @@ -729,17 +729,26 @@ doswitch: * we just stored in the table (c). */ n = *fmt; - if (n == ']' || __collate_range_cmp (n, c) < 0) { + if (n == ']' + || (__collate_load_error && n < c) + || __collate_range_cmp (n, c) < 0 + ) { c = '-'; break; /* resume the for(;;) */ } fmt++; /* fill in the range */ - for (i = 0; i < 256; i ++) - if ( __collate_range_cmp (c, i) < 0 - && __collate_range_cmp (i, n) <= 0 - ) - tab[i] = v; + if (__collate_load_error) { + do { + tab[++c] = v; + } while (c < n); + } else { + for (i = 0; i < 256; i ++) + if ( __collate_range_cmp (c, i) < 0 + && __collate_range_cmp (i, n) <= 0 + ) + tab[i] = v; + } #if 1 /* XXX another disgusting compatibility hack */ c = n; /* |