From f9d135173d727a644b7a44b7a30a67686041501c Mon Sep 17 00:00:00 2001 From: ache Date: Fri, 4 Apr 1997 19:40:49 +0000 Subject: Speedup in case locale not used --- lib/libc/regex/regcomp.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'lib/libc') diff --git a/lib/libc/regex/regcomp.c b/lib/libc/regex/regcomp.c index 98d3755..8bb1355 100644 --- a/lib/libc/regex/regcomp.c +++ b/lib/libc/regex/regcomp.c @@ -804,12 +804,18 @@ register cset *cs; if (start == finish) CHadd(cs, start); else { - (void)REQUIRE(__collate_range_cmp(start, finish) <= 0, REG_ERANGE); - for (i = CHAR_MIN; i <= CHAR_MAX; i++) { - if ( __collate_range_cmp(start, i) <= 0 - && __collate_range_cmp(i, finish) <= 0 - ) + if (__collate_load_error) { + (void)REQUIRE((uch)start <= (uch)finish, REG_ERANGE); + for (i = (uch)start; i <= (uch)finish; i++) CHadd(cs, i); + } else { + (void)REQUIRE(__collate_range_cmp(start, finish) <= 0, REG_ERANGE); + for (i = CHAR_MIN; i <= CHAR_MAX; i++) { + if ( __collate_range_cmp(start, i) <= 0 + && __collate_range_cmp(i, finish) <= 0 + ) + CHadd(cs, i); + } } } break; -- cgit v1.1