mirror of git://sourceware.org/git/glibc.git
Update.
2000-08-12 Ulrich Drepper <drepper@redhat.com> * posix/regex.c (compile_range): Implement collation sequence handling for glibc. Use simple character ordering otherwise and not strcoll.
This commit is contained in:
parent
451fc03299
commit
8868f97b04
|
|
@ -1,3 +1,9 @@
|
||||||
|
2000-08-12 Ulrich Drepper <drepper@redhat.com>
|
||||||
|
|
||||||
|
* posix/regex.c (compile_range): Implement collation sequence
|
||||||
|
handling for glibc. Use simple character ordering otherwise and
|
||||||
|
not strcoll.
|
||||||
|
|
||||||
2000-08-12 Mark Kettenis <kettenis@gnu.org>
|
2000-08-12 Mark Kettenis <kettenis@gnu.org>
|
||||||
|
|
||||||
* sysdeps/generic/scandir64.c: Include <dirent.h>.
|
* sysdeps/generic/scandir64.c: Include <dirent.h>.
|
||||||
|
|
|
||||||
|
|
@ -3507,23 +3507,19 @@ compile_range (range_start_char, p_ptr, pend, translate, syntax, b)
|
||||||
unsigned char *b;
|
unsigned char *b;
|
||||||
{
|
{
|
||||||
unsigned this_char;
|
unsigned this_char;
|
||||||
|
|
||||||
const char *p = *p_ptr;
|
const char *p = *p_ptr;
|
||||||
reg_errcode_t ret;
|
reg_errcode_t ret;
|
||||||
char range_start[2];
|
#if _LIBC
|
||||||
char range_end[2];
|
const unsigned char *collseq;
|
||||||
char ch[2];
|
unsigned int start_colseq;
|
||||||
|
unsigned int end_colseq;
|
||||||
|
#else
|
||||||
|
unsigned end_char;
|
||||||
|
#endif
|
||||||
|
|
||||||
if (p == pend)
|
if (p == pend)
|
||||||
return REG_ERANGE;
|
return REG_ERANGE;
|
||||||
|
|
||||||
/* Fetch the endpoints without translating them; the
|
|
||||||
appropriate translation is done in the bit-setting loop below. */
|
|
||||||
range_start[0] = TRANSLATE (range_start_char);
|
|
||||||
range_start[1] = '\0';
|
|
||||||
range_end[0] = TRANSLATE (p[0]);
|
|
||||||
range_end[1] = '\0';
|
|
||||||
|
|
||||||
/* Have to increment the pointer into the pattern string, so the
|
/* Have to increment the pointer into the pattern string, so the
|
||||||
caller isn't still at the ending character. */
|
caller isn't still at the ending character. */
|
||||||
(*p_ptr)++;
|
(*p_ptr)++;
|
||||||
|
|
@ -3531,19 +3527,34 @@ compile_range (range_start_char, p_ptr, pend, translate, syntax, b)
|
||||||
/* Report an error if the range is empty and the syntax prohibits this. */
|
/* Report an error if the range is empty and the syntax prohibits this. */
|
||||||
ret = syntax & RE_NO_EMPTY_RANGES ? REG_ERANGE : REG_NOERROR;
|
ret = syntax & RE_NO_EMPTY_RANGES ? REG_ERANGE : REG_NOERROR;
|
||||||
|
|
||||||
/* Here we see why `this_char' has to be larger than an `unsigned
|
#if _LIBC
|
||||||
char' -- we would otherwise go into an infinite loop, since all
|
collseq = (const unsigned char *) _NL_CURRENT (LC_COLLATE,
|
||||||
characters <= 0xff. */
|
_NL_COLLATE_COLLSEQMB);
|
||||||
ch[1] = '\0';
|
|
||||||
|
start_colseq = collseq[TRANSLATE (range_start_char)];
|
||||||
|
end_colseq = collseq[TRANSLATE (p[0])];
|
||||||
for (this_char = 0; this_char <= (unsigned char) -1; ++this_char)
|
for (this_char = 0; this_char <= (unsigned char) -1; ++this_char)
|
||||||
{
|
{
|
||||||
ch[0] = this_char;
|
unsigned int this_colseq = collseq[TRANSLATE (this_char)];
|
||||||
if (strcoll (range_start, ch) <= 0 && strcoll (ch, range_end) <= 0)
|
|
||||||
|
if (start_colseq <= this_colseq && this_colseq <= end_colseq)
|
||||||
{
|
{
|
||||||
SET_LIST_BIT (TRANSLATE (this_char));
|
SET_LIST_BIT (TRANSLATE (this_char));
|
||||||
ret = REG_NOERROR;
|
ret = REG_NOERROR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
/* Here we see why `this_char' has to be larger than an `unsigned
|
||||||
|
char' -- we would otherwise go into an infinite loop, since all
|
||||||
|
characters <= 0xff. */
|
||||||
|
range_start_char = TRANSLATE (range_start_char);
|
||||||
|
end_char = TRANSLATE (p[0]);
|
||||||
|
for (this_char = range_start_char; this_char <= end_char; ++this_char)
|
||||||
|
{
|
||||||
|
SET_LIST_BIT (TRANSLATE (this_char));
|
||||||
|
ret = REG_NOERROR;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue