diff options
author | ache <ache@FreeBSD.org> | 1996-08-12 18:03:54 +0000 |
---|---|---|
committer | ache <ache@FreeBSD.org> | 1996-08-12 18:03:54 +0000 |
commit | d0049dcf850283d6794329e6cff859682befa90b (patch) | |
tree | 948aed36a437fd4c5bff3efa6cb71a79894814fa /gnu/lib/libregex | |
parent | f25f1527757956815677050b63a192726c70543f (diff) | |
download | FreeBSD-src-d0049dcf850283d6794329e6cff859682befa90b.zip FreeBSD-src-d0049dcf850283d6794329e6cff859682befa90b.tar.gz |
Use collate for alpha character ranges
Diffstat (limited to 'gnu/lib/libregex')
-rw-r--r-- | gnu/lib/libregex/Makefile | 5 | ||||
-rw-r--r-- | gnu/lib/libregex/regex.c | 18 |
2 files changed, 20 insertions, 3 deletions
diff --git a/gnu/lib/libregex/Makefile b/gnu/lib/libregex/Makefile index a88856b..dc2b75d 100644 --- a/gnu/lib/libregex/Makefile +++ b/gnu/lib/libregex/Makefile @@ -1,8 +1,9 @@ -# $Header: /home/ncvs/src/gnu/lib/libregex/Makefile,v 1.14 1995/03/12 23:21:29 ache Exp $ +# $Header: /home/ncvs/src/gnu/lib/libregex/Makefile,v 1.15 1995/08/06 12:23:01 bde Exp $ LIB= gnuregex -CFLAGS+=-I${.CURDIR} -DHAVE_STRING_H=1 -DSTDC_HEADERS=1 +CFLAGS+=-I${.CURDIR} -I${.CURDIR}/../../../lib/libc/locale \ + -DHAVE_STRING_H=1 -DSTDC_HEADERS=1 SRCS= regex.c NOMAN= noman diff --git a/gnu/lib/libregex/regex.c b/gnu/lib/libregex/regex.c index 320b72b..7f4b0ae 100644 --- a/gnu/lib/libregex/regex.c +++ b/gnu/lib/libregex/regex.c @@ -125,6 +125,10 @@ init_syntax_once () #endif /* not emacs */ +#ifdef __FreeBSD__ +#include "collate.h" +#endif + /* Get the interface, including the syntax bits. */ #include "regex.h" @@ -2315,9 +2319,21 @@ compile_range (p_ptr, pend, translate, syntax, b) (*p_ptr)++; /* If the start is after the end, the range is empty. */ +#ifdef __FreeBSD__ + if (__collcmp (range_start, range_end) > 0) +#else if (range_start > range_end) +#endif return syntax & RE_NO_EMPTY_RANGES ? REG_ERANGE : REG_NOERROR; +#ifdef __FreeBSD__ + for (this_char = 0; this_char < 1 << BYTEWIDTH; this_char++) + if ( __collcmp(range_start, this_char) <= 0 + && __collcmp(this_char, range_end) <= 0 + ) { + SET_LIST_BIT (TRANSLATE (this_char)); + } +#else /* Here we see why `this_char' has to be larger than an `unsigned char' -- the range is inclusive, so if `range_end' == 0xff (assuming 8-bit characters), we would otherwise go into an infinite @@ -2326,7 +2342,7 @@ compile_range (p_ptr, pend, translate, syntax, b) { SET_LIST_BIT (TRANSLATE (this_char)); } - +#endif return REG_NOERROR; } |