diff options
Diffstat (limited to 'lib/regcomp.c')
| -rw-r--r-- | lib/regcomp.c | 27 |
1 files changed, 9 insertions, 18 deletions
diff --git a/lib/regcomp.c b/lib/regcomp.c index 53eb2263740..0e4816c89c2 100644 --- a/lib/regcomp.c +++ b/lib/regcomp.c | |||
| @@ -2684,15 +2684,14 @@ parse_dup_op (bin_tree_t *elem, re_string_t *regexp, re_dfa_t *dfa, | |||
| 2684 | 2684 | ||
| 2685 | # ifdef RE_ENABLE_I18N | 2685 | # ifdef RE_ENABLE_I18N |
| 2686 | /* Convert the byte B to the corresponding wide character. In a | 2686 | /* Convert the byte B to the corresponding wide character. In a |
| 2687 | unibyte locale, treat B as itself if it is an encoding error. | 2687 | unibyte locale, treat B as itself. In a multibyte locale, return |
| 2688 | In a multibyte locale, return WEOF if B is an encoding error. */ | 2688 | WEOF if B is an encoding error. */ |
| 2689 | static wint_t | 2689 | static wint_t |
| 2690 | parse_byte (unsigned char b, re_charset_t *mbcset) | 2690 | parse_byte (unsigned char b, re_charset_t *mbcset) |
| 2691 | { | 2691 | { |
| 2692 | wint_t wc = __btowc (b); | 2692 | return mbcset == NULL ? b : __btowc (b); |
| 2693 | return wc == WEOF && !mbcset ? b : wc; | ||
| 2694 | } | 2693 | } |
| 2695 | #endif | 2694 | # endif |
| 2696 | 2695 | ||
| 2697 | /* Local function for parse_bracket_exp only used in case of NOT _LIBC. | 2696 | /* Local function for parse_bracket_exp only used in case of NOT _LIBC. |
| 2698 | Build the range expression which starts from START_ELEM, and ends | 2697 | Build the range expression which starts from START_ELEM, and ends |
| @@ -3531,18 +3530,10 @@ build_equiv_class (bitset_t sbcset, const unsigned char *name) | |||
| 3531 | continue; | 3530 | continue; |
| 3532 | /* Compare only if the length matches and the collation rule | 3531 | /* Compare only if the length matches and the collation rule |
| 3533 | index is the same. */ | 3532 | index is the same. */ |
| 3534 | if (len == weights[idx2 & 0xffffff] && (idx1 >> 24) == (idx2 >> 24)) | 3533 | if (len == weights[idx2 & 0xffffff] && (idx1 >> 24) == (idx2 >> 24) |
| 3535 | { | 3534 | && memcmp (weights + (idx1 & 0xffffff) + 1, |
| 3536 | int cnt = 0; | 3535 | weights + (idx2 & 0xffffff) + 1, len) == 0) |
| 3537 | 3536 | bitset_set (sbcset, ch); | |
| 3538 | while (cnt <= len && | ||
| 3539 | weights[(idx1 & 0xffffff) + 1 + cnt] | ||
| 3540 | == weights[(idx2 & 0xffffff) + 1 + cnt]) | ||
| 3541 | ++cnt; | ||
| 3542 | |||
| 3543 | if (cnt > len) | ||
| 3544 | bitset_set (sbcset, ch); | ||
| 3545 | } | ||
| 3546 | } | 3537 | } |
| 3547 | /* Check whether the array has enough space. */ | 3538 | /* Check whether the array has enough space. */ |
| 3548 | if (BE (*equiv_class_alloc == mbcset->nequiv_classes, 0)) | 3539 | if (BE (*equiv_class_alloc == mbcset->nequiv_classes, 0)) |
| @@ -3802,9 +3793,9 @@ free_charset (re_charset_t *cset) | |||
| 3802 | # ifdef _LIBC | 3793 | # ifdef _LIBC |
| 3803 | re_free (cset->coll_syms); | 3794 | re_free (cset->coll_syms); |
| 3804 | re_free (cset->equiv_classes); | 3795 | re_free (cset->equiv_classes); |
| 3796 | # endif | ||
| 3805 | re_free (cset->range_starts); | 3797 | re_free (cset->range_starts); |
| 3806 | re_free (cset->range_ends); | 3798 | re_free (cset->range_ends); |
| 3807 | # endif | ||
| 3808 | re_free (cset->char_classes); | 3799 | re_free (cset->char_classes); |
| 3809 | re_free (cset); | 3800 | re_free (cset); |
| 3810 | } | 3801 | } |