diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/regex.c | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/src/regex.c b/src/regex.c index 8b7aecf0d80..81b06ff5fe1 100644 --- a/src/regex.c +++ b/src/regex.c | |||
| @@ -930,7 +930,7 @@ static const char *re_error_msg[] = | |||
| 930 | change it ourselves. */ | 930 | change it ourselves. */ |
| 931 | int re_max_failures = 2000; | 931 | int re_max_failures = 2000; |
| 932 | 932 | ||
| 933 | typedef const unsigned char *fail_stack_elt_t; | 933 | typedef unsigned char *fail_stack_elt_t; |
| 934 | 934 | ||
| 935 | typedef struct | 935 | typedef struct |
| 936 | { | 936 | { |
| @@ -2733,7 +2733,7 @@ re_compile_fastmap (bufp) | |||
| 2733 | register char *fastmap = bufp->fastmap; | 2733 | register char *fastmap = bufp->fastmap; |
| 2734 | unsigned char *pattern = bufp->buffer; | 2734 | unsigned char *pattern = bufp->buffer; |
| 2735 | unsigned long size = bufp->used; | 2735 | unsigned long size = bufp->used; |
| 2736 | const unsigned char *p = pattern; | 2736 | unsigned char *p = pattern; |
| 2737 | register unsigned char *pend = pattern + size; | 2737 | register unsigned char *pend = pattern + size; |
| 2738 | 2738 | ||
| 2739 | /* Assume that each path through the pattern can be null until | 2739 | /* Assume that each path through the pattern can be null until |
| @@ -3188,8 +3188,10 @@ static boolean alt_match_null_string_p (), | |||
| 3188 | 3188 | ||
| 3189 | /* This converts PTR, a pointer into one of the search strings `string1' | 3189 | /* This converts PTR, a pointer into one of the search strings `string1' |
| 3190 | and `string2' into an offset from the beginning of that string. */ | 3190 | and `string2' into an offset from the beginning of that string. */ |
| 3191 | #define POINTER_TO_OFFSET(ptr) \ | 3191 | #define POINTER_TO_OFFSET(ptr) \ |
| 3192 | (FIRST_STRING_P (ptr) ? (ptr) - string1 : (ptr) - string2 + size1) | 3192 | (FIRST_STRING_P (ptr) \ |
| 3193 | ? ((regoff_t) ((ptr) - string1)) \ | ||
| 3194 | : ((regoff_t) ((ptr) - string2 + size1))) | ||
| 3193 | 3195 | ||
| 3194 | /* Macros for dealing with the split strings in re_match_2. */ | 3196 | /* Macros for dealing with the split strings in re_match_2. */ |
| 3195 | 3197 | ||
| @@ -3628,8 +3630,9 @@ re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop) | |||
| 3628 | if (regs->num_regs > 0) | 3630 | if (regs->num_regs > 0) |
| 3629 | { | 3631 | { |
| 3630 | regs->start[0] = pos; | 3632 | regs->start[0] = pos; |
| 3631 | regs->end[0] = (MATCHING_IN_FIRST_STRING ? d - string1 | 3633 | regs->end[0] = (MATCHING_IN_FIRST_STRING |
| 3632 | : d - string2 + size1); | 3634 | ? ((regoff_t) (d - string1)) |
| 3635 | : ((regoff_t) (d - string2 + size1))); | ||
| 3633 | } | 3636 | } |
| 3634 | 3637 | ||
| 3635 | /* Go through the first `min (num_regs, regs->num_regs)' | 3638 | /* Go through the first `min (num_regs, regs->num_regs)' |
| @@ -3640,8 +3643,10 @@ re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop) | |||
| 3640 | regs->start[mcnt] = regs->end[mcnt] = -1; | 3643 | regs->start[mcnt] = regs->end[mcnt] = -1; |
| 3641 | else | 3644 | else |
| 3642 | { | 3645 | { |
| 3643 | regs->start[mcnt] = POINTER_TO_OFFSET (regstart[mcnt]); | 3646 | regs->start[mcnt] |
| 3644 | regs->end[mcnt] = POINTER_TO_OFFSET (regend[mcnt]); | 3647 | = (regoff_t) POINTER_TO_OFFSET (regstart[mcnt]); |
| 3648 | regs->end[mcnt] | ||
| 3649 | = (regoff_t) POINTER_TO_OFFSET (regend[mcnt]); | ||
| 3645 | } | 3650 | } |
| 3646 | } | 3651 | } |
| 3647 | 3652 | ||