summaryrefslogtreecommitdiff
path: root/src/regex.c
diff options
context:
space:
mode:
authorJim Blandy <jimb@redhat.com>1992-12-14 02:28:29 +0000
committerJim Blandy <jimb@redhat.com>1992-12-14 02:28:29 +0000
commit4af46de60c1d273d1caf137799594a8f820538d1 (patch)
tree3906b363bf22b0d493c8fd294a4d6f29cdc06b88 /src/regex.c
parent1d650ff1bdcc1400a54ad77e8d074b880df66c80 (diff)
downloademacs-4af46de60c1d273d1caf137799594a8f820538d1.tar.gz
*** empty log message ***
Diffstat (limited to 'src/regex.c')
-rw-r--r--src/regex.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/regex.c b/src/regex.c
index c1609504dff..b0c15c2ca87 100644
--- a/src/regex.c
+++ b/src/regex.c
@@ -2197,18 +2197,20 @@ compile_range (p_ptr, pend, translate, syntax, b)
unsigned this_char;
const char *p = *p_ptr;
+ int range_start, range_end;
- /* Even though the pattern is a signed `char *', we need to fetch into
- `unsigned char's. Reason: if the high bit of the pattern character
- is set, the range endpoints will be negative if we fetch into a
- signed `char *'. */
- unsigned char range_end;
- unsigned char range_start = p[-2];
-
if (p == pend)
return REG_ERANGE;
- PATFETCH (range_end);
+ /* Even though the pattern is a signed `char *', we need to fetch
+ with unsigned char *'s; if the high bit of the pattern character
+ is set, the range endpoints will be negative if we fetch using a
+ signed char *.
+
+ We also want to fetch the endpoints without translating them; the
+ appropriate translation is done in the bit-setting loop below. */
+ range_start = ((unsigned char *) p)[-2];
+ range_end = ((unsigned char *) p)[0];
/* Have to increment the pointer into the pattern string, so the
caller isn't still at the ending character. */