summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1997-07-04 20:46:22 +0000
committerRichard M. Stallman <rms@gnu.org>1997-07-04 20:46:22 +0000
commitbc192b5b1a851f1584f5fdf568d131286d936278 (patch)
treee6487577dd32c8b8801d31f54c2d916813bc78f8
parent2e34157cd9e74150e79e0ce23236252b47fb5f1a (diff)
downloademacs-bc192b5b1a851f1584f5fdf568d131286d936278.tar.gz
(TRANSLATE, re_search_2, re_match_2_internal,bcmp_translate):
Use RE_TRANSLATE instead of accessing translate array directly.
-rw-r--r--src/regex.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/regex.c b/src/regex.c
index 6a45db69b8f..4924eba3130 100644
--- a/src/regex.c
+++ b/src/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
@@ -3810,7 +3810,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 +4500,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 +5895,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;