X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=regex.c;h=5a98af0678ef5da6d7332bd4a649a66ada9d9584;hb=cf10a561333068574a64c90965de30e95c8820fd;hp=6a45db69b8fce0a4c2802ac8ad996d981a909647;hpb=837c5301b458371192e6bd370dac274b070c8dc2;p=gnulib.git diff --git a/regex.c b/regex.c index 6a45db69b..5a98af067 100644 --- a/regex.c +++ b/regex.c @@ -1540,7 +1540,7 @@ static reg_errcode_t compile_range (); when we use a character as a subscript we must make it unsigned. */ #ifndef TRANSLATE #define TRANSLATE(d) \ - (translate ? (unsigned char) translate[(unsigned char) (d)] : (d)) + (translate ? (unsigned char) RE_TRANSLATE (translate, (unsigned char) (d)) : (d)) #endif @@ -2185,11 +2185,11 @@ regex_compile (pattern, size, syntax, bufp) } else { - /* Could be the end of the bracket expression. If it's - not (i.e., when the bracket expression is `[]' so - far), the ']' character bit gets set way below. */ - if (c == ']' && p != p1 + 1) - break; + /* Could be the end of the bracket expression. If it's + not (i.e., when the bracket expression is `[]' so + far), the ']' character bit gets set way below. */ + if (c == ']' && p != p1 + 1) + break; } /* If C indicates start of multibyte char, get the @@ -2210,7 +2210,8 @@ regex_compile (pattern, size, syntax, bufp) else if (!escaped_char && syntax & RE_CHAR_CLASSES && c == '[' && *p == ':') - { /* Leave room for the null. */ + { + /* Leave room for the null. */ char str[CHAR_CLASS_MAX_LENGTH + 1]; PATFETCH (c); @@ -3810,7 +3811,7 @@ re_search_2 (bufp, string1, size1, string2, size2, startpos, range, regs, stop) if (translate) while (range > lim && !fastmap[(unsigned char) - translate[(unsigned char) *d++]]) + RE_TRANSLATE (translate, (unsigned char) *d++)]) range--; else while (range > lim && !fastmap[(unsigned char) *d++]) @@ -4500,7 +4501,7 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop) do { PREFETCH (); - if ((unsigned char) translate[(unsigned char) *d++] + if ((unsigned char) RE_TRANSLATE (translate, (unsigned char) *d++) != (unsigned char) *p++) goto fail; } @@ -5895,7 +5896,8 @@ bcmp_translate (s1, s2, len, translate) register unsigned char *p1 = s1, *p2 = s2; while (len) { - if (translate[*p1++] != translate[*p2++]) return 1; + if (RE_TRANSLATE (translate, *p1++) != RE_TRANSLATE (translate, *p2++)) + return 1; len--; } return 0;