mirror of
https://github.com/freebsd/freebsd-src.git
synced 2024-11-29 11:02:44 +00:00
Speedup in case locale not used
This commit is contained in:
parent
b5a6eb1833
commit
b15443ba83
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=24640
@ -1,7 +1,7 @@
|
||||
# @(#)Makefile 8.1 (Berkeley) 6/4/93
|
||||
|
||||
LIB=compat
|
||||
CFLAGS+=-DLIBC_SCCS -DSYSLIBC_SCCS
|
||||
CFLAGS+=-DLIBC_SCCS -DSYSLIBC_SCCS -I${.CURDIR}/../libc/locale
|
||||
AINC= -I${.CURDIR}/../libc/${MACHINE}
|
||||
NOPIC=
|
||||
|
||||
|
@ -38,6 +38,7 @@
|
||||
#include <ctype.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "collate.h"
|
||||
#include "regmagic.h"
|
||||
|
||||
/*
|
||||
@ -181,28 +182,10 @@ STATIC void regc();
|
||||
STATIC void reginsert();
|
||||
STATIC void regtail();
|
||||
STATIC void regoptail();
|
||||
STATIC int collate_range_cmp();
|
||||
#ifdef STRCSPN
|
||||
STATIC int strcspn();
|
||||
#endif
|
||||
|
||||
static int collate_range_cmp (c1, c2)
|
||||
int c1, c2;
|
||||
{
|
||||
static char s1[2], s2[2];
|
||||
int ret;
|
||||
|
||||
c1 &= UCHAR_MAX;
|
||||
c2 &= UCHAR_MAX;
|
||||
if (c1 == c2)
|
||||
return (0);
|
||||
s1[0] = c1;
|
||||
s2[0] = c2;
|
||||
if ((ret = strcoll(s1, s2)) != 0)
|
||||
return (ret);
|
||||
return (c1 - c2);
|
||||
}
|
||||
|
||||
/*
|
||||
- regcomp - compile a regular expression into internal code
|
||||
*
|
||||
@ -525,14 +508,21 @@ int *flagp;
|
||||
else {
|
||||
class = UCHARAT(regparse-2);
|
||||
classend = UCHARAT(regparse);
|
||||
if (collate_range_cmp(class, classend) > 0)
|
||||
FAIL("invalid [] range");
|
||||
for (i = 0; i <= UCHAR_MAX; i++)
|
||||
if ( i != class
|
||||
&& collate_range_cmp(class, i) <= 0
|
||||
&& collate_range_cmp(i, classend) <= 0
|
||||
)
|
||||
regc(i);
|
||||
if (__collate_load_error) {
|
||||
if (class > classend)
|
||||
FAIL("invalid [] range");
|
||||
for (class++; class <= classend; class++)
|
||||
regc(class);
|
||||
} else {
|
||||
if (__collate_range_cmp(class, classend) > 0)
|
||||
FAIL("invalid [] range");
|
||||
for (i = 0; i <= UCHAR_MAX; i++)
|
||||
if ( i != class
|
||||
&& __collate_range_cmp(class, i) <= 0
|
||||
&& __collate_range_cmp(i, classend) <= 0
|
||||
)
|
||||
regc(i);
|
||||
}
|
||||
regparse++;
|
||||
}
|
||||
} else
|
||||
|
Loading…
Reference in New Issue
Block a user