diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/search.c | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/src/search.c b/src/search.c index d86a7cca7b2..73ec3a78e58 100644 --- a/src/search.c +++ b/src/search.c | |||
| @@ -1692,22 +1692,31 @@ boyer_moore (n, base_pat, len, len_byte, trt, inverse_trt, | |||
| 1692 | i = infinity; | 1692 | i = infinity; |
| 1693 | if (! NILP (trt)) | 1693 | if (! NILP (trt)) |
| 1694 | { | 1694 | { |
| 1695 | /* If the byte currently looking at is a head of a character | 1695 | /* If the byte currently looking at is the last of a |
| 1696 | to check case-equivalents, set CH to that character. An | 1696 | character to check case-equivalents, set CH to that |
| 1697 | ASCII character and a non-ASCII character matching with | 1697 | character. An ASCII character and a non-ASCII character |
| 1698 | CHARSET_BASE are to be checked. */ | 1698 | matching with CHARSET_BASE are to be checked. */ |
| 1699 | int ch = -1; | 1699 | int ch = -1; |
| 1700 | 1700 | ||
| 1701 | if (ASCII_BYTE_P (*ptr) || ! multibyte) | 1701 | if (ASCII_BYTE_P (*ptr) || ! multibyte) |
| 1702 | ch = *ptr; | 1702 | ch = *ptr; |
| 1703 | else if (charset_base && CHAR_HEAD_P (*ptr)) | 1703 | else if (charset_base |
| 1704 | && (pat_end - ptr) == 1 || CHAR_HEAD_P (ptr[1])) | ||
| 1704 | { | 1705 | { |
| 1705 | ch = STRING_CHAR (ptr, pat_end - ptr); | 1706 | unsigned char *charstart = ptr - 1; |
| 1707 | |||
| 1708 | while (! (CHAR_HEAD_P (*charstart))) | ||
| 1709 | charstart--; | ||
| 1710 | ch = STRING_CHAR (charstart, ptr - charstart + 1); | ||
| 1706 | if (charset_base != (ch & ~CHAR_FIELD3_MASK)) | 1711 | if (charset_base != (ch & ~CHAR_FIELD3_MASK)) |
| 1707 | ch = -1; | 1712 | ch = -1; |
| 1708 | } | 1713 | } |
| 1709 | 1714 | ||
| 1710 | j = *ptr; | 1715 | if (ch > 0400) |
| 1716 | j = ((unsigned char) ch) | 0200; | ||
| 1717 | else | ||
| 1718 | j = *ptr; | ||
| 1719 | |||
| 1711 | if (i == infinity) | 1720 | if (i == infinity) |
| 1712 | stride_for_teases = BM_tab[j]; | 1721 | stride_for_teases = BM_tab[j]; |
| 1713 | 1722 | ||
| @@ -1717,12 +1726,8 @@ boyer_moore (n, base_pat, len, len_byte, trt, inverse_trt, | |||
| 1717 | if (ch >= 0) | 1726 | if (ch >= 0) |
| 1718 | { | 1727 | { |
| 1719 | int starting_ch = ch; | 1728 | int starting_ch = ch; |
| 1720 | int starting_j; | 1729 | int starting_j = j; |
| 1721 | 1730 | ||
| 1722 | if (ch > 0400) | ||
| 1723 | starting_j = ((unsigned char) ch) | 0200; | ||
| 1724 | else | ||
| 1725 | starting_j = (unsigned char) ch; | ||
| 1726 | while (1) | 1731 | while (1) |
| 1727 | { | 1732 | { |
| 1728 | TRANSLATE (ch, inverse_trt, ch); | 1733 | TRANSLATE (ch, inverse_trt, ch); |