summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2000-10-27 13:29:36 +0000
committerStefan Monnier <monnier@iro.umontreal.ca>2000-10-27 13:29:36 +0000
commit5343a3e24d28c2ce7dc87cb997bc9674293be296 (patch)
treefbe9ddf2baea802aaae5274c9f3961aba5326df5
parent627eb1327e16ff9a148acb3329b971828e41c1f5 (diff)
downloadgnulib-5343a3e24d28c2ce7dc87cb997bc9674293be296.tar.gz
(POP_FAILURE_REG_OR_COUNT, re_match_2_internal)
(re_match_2_internal, re_match_2_internal, re_match_2_internal): Giving in to popular pressure to shut up the compiler with casts.
-rw-r--r--regex.c27
1 files changed, 14 insertions, 13 deletions
diff --git a/regex.c b/regex.c
index e10a3565f2..f3e382915c 100644
--- a/regex.c
+++ b/regex.c
@@ -23,7 +23,9 @@
- structure the opcode space into opcode+flag.
- merge with glibc's regex.[ch].
- replace (succeed_n + jump_n + set_number_at) with something that doesn't
- need to modify the compiled regexp.
+ need to modify the compiled regexp so that re_match can be reentrant.
+ - get rid of on_failure_jump_smart by doing the optimization in re_comp
+ rather than at run-time, so that re_match can be reentrant.
*/
/* AIX requires this to be the first thing in the file. */
@@ -1487,9 +1489,8 @@ do { \
if (reg == -1) \
{ \
/* It's a counter. */ \
- /* Here, we discard `const', which makes re_match non-reentrant. \
- Gcc gives a warning for it, which is good. */ \
- unsigned char *ptr = POP_FAILURE_POINTER (); \
+ /* Here, we discard `const', making re_match non-reentrant. */ \
+ unsigned char *ptr = (unsigned char*) POP_FAILURE_POINTER (); \
reg = POP_FAILURE_INT (); \
STORE_NUMBER (ptr, reg); \
DEBUG_PRINT3 (" Pop counter %p = %d\n", ptr, reg); \
@@ -5276,9 +5277,9 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop)
mcnt, p + mcnt);
{
re_char *p1 = p; /* Next operation. */
- /* Please don't add casts to try and shut up GCC. */
- unsigned char *p2 = p + mcnt; /* Destination of the jump. */
- unsigned char *p3 = p - 3; /* Location of the opcode. */
+ /* Here, we discard `const', making re_match non-reentrant. */
+ unsigned char *p2 = (unsigned char*) p + mcnt; /* Jump dest. */
+ unsigned char *p3 = (unsigned char*) p - 3; /* opcode location. */
p -= 3; /* Reset so that we will re-execute the
instruction once it's been changed. */
@@ -5328,8 +5329,8 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop)
/* Originally, mcnt is how many times we HAVE to succeed. */
if (mcnt != 0)
{
- /* Please don't add a cast to try and shut up GCC. */
- unsigned char *p2 = p + 2; /* Location of the counter. */
+ /* Here, we discard `const', making re_match non-reentrant. */
+ unsigned char *p2 = (unsigned char*) p + 2; /* counter loc. */
mcnt--;
p += 4;
PUSH_NUMBER (p2, mcnt);
@@ -5347,8 +5348,8 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop)
/* Originally, this is how many times we CAN jump. */
if (mcnt != 0)
{
- /* Please don't add a cast to try and shut up GCC. */
- unsigned char *p2 = p + 2; /* Location of the counter. */
+ /* Here, we discard `const', making re_match non-reentrant. */
+ unsigned char *p2 = (unsigned char*) p + 2; /* counter loc. */
mcnt--;
PUSH_NUMBER (p2, mcnt);
goto unconditional_jump;
@@ -5364,8 +5365,8 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop)
DEBUG_PRINT1 ("EXECUTING set_number_at.\n");
EXTRACT_NUMBER_AND_INCR (mcnt, p);
- /* Please don't add a cast to try and shut up GCC. */
- p2 = p + mcnt;
+ /* Here, we discard `const', making re_match non-reentrant. */
+ p2 = (unsigned char*) p + mcnt;
/* Signedness doesn't matter since we only copy MCNT's bits . */
EXTRACT_NUMBER_AND_INCR (mcnt, p);
DEBUG_PRINT3 (" Setting %p to %d.\n", p2, mcnt);