diff options
| author | Andreas Schwab | 1998-04-15 10:33:18 +0000 |
|---|---|---|
| committer | Andreas Schwab | 1998-04-15 10:33:18 +0000 |
| commit | 28703c16f3bc7e008500eacea296384551492f65 (patch) | |
| tree | 9b192c1c52e999a86eb096a56ead9caf012fb0fc /src | |
| parent | 4da4775f0d8e1bb8098f5d83ffc0643d0817a788 (diff) | |
| download | emacs-28703c16f3bc7e008500eacea296384551492f65.tar.gz emacs-28703c16f3bc7e008500eacea296384551492f65.zip | |
Use RE_TRANSLATE_P to check whether translation is
needed.
Diffstat (limited to 'src')
| -rw-r--r-- | src/regex.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/regex.c b/src/regex.c index f8e2dcb27f5..a6c186c5c13 100644 --- a/src/regex.c +++ b/src/regex.c | |||
| @@ -1540,7 +1540,7 @@ static reg_errcode_t compile_range (); | |||
| 1540 | #define PATFETCH(c) \ | 1540 | #define PATFETCH(c) \ |
| 1541 | do {if (p == pend) return REG_EEND; \ | 1541 | do {if (p == pend) return REG_EEND; \ |
| 1542 | c = (unsigned char) *p++; \ | 1542 | c = (unsigned char) *p++; \ |
| 1543 | if (translate) c = RE_TRANSLATE (translate, c); \ | 1543 | if (RE_TRANSLATE_P (translate)) c = RE_TRANSLATE (translate, c); \ |
| 1544 | } while (0) | 1544 | } while (0) |
| 1545 | #endif | 1545 | #endif |
| 1546 | 1546 | ||
| @@ -1561,7 +1561,8 @@ static reg_errcode_t compile_range (); | |||
| 1561 | when we use a character as a subscript we must make it unsigned. */ | 1561 | when we use a character as a subscript we must make it unsigned. */ |
| 1562 | #ifndef TRANSLATE | 1562 | #ifndef TRANSLATE |
| 1563 | #define TRANSLATE(d) \ | 1563 | #define TRANSLATE(d) \ |
| 1564 | (translate ? (unsigned) RE_TRANSLATE (translate, (unsigned) (d)) : (d)) | 1564 | (RE_TRANSLATE_P (translate) \ |
| 1565 | ? (unsigned) RE_TRANSLATE (translate, (unsigned) (d)) : (d)) | ||
| 1565 | #endif | 1566 | #endif |
| 1566 | 1567 | ||
| 1567 | 1568 | ||
| @@ -3785,8 +3786,8 @@ re_search_2 (bufp, string1, size1, string2, size2, startpos, range, regs, stop) | |||
| 3785 | 3786 | ||
| 3786 | /* Written out as an if-else to avoid testing `translate' | 3787 | /* Written out as an if-else to avoid testing `translate' |
| 3787 | inside the loop. */ | 3788 | inside the loop. */ |
| 3788 | if (translate) | 3789 | if (RE_TRANSLATE_P (translate)) |
| 3789 | { | 3790 | { |
| 3790 | if (multibyte) | 3791 | if (multibyte) |
| 3791 | while (range > lim) | 3792 | while (range > lim) |
| 3792 | { | 3793 | { |
| @@ -3822,7 +3823,7 @@ re_search_2 (bufp, string1, size1, string2, size2, startpos, range, regs, stop) | |||
| 3822 | : size1 - startpos); | 3823 | : size1 - startpos); |
| 3823 | 3824 | ||
| 3824 | buf_ch = STRING_CHAR (d, room); | 3825 | buf_ch = STRING_CHAR (d, room); |
| 3825 | if (translate) | 3826 | if (RE_TRANSLATE_P (translate)) |
| 3826 | buf_ch = RE_TRANSLATE (translate, buf_ch); | 3827 | buf_ch = RE_TRANSLATE (translate, buf_ch); |
| 3827 | 3828 | ||
| 3828 | if (! (buf_ch >= 0400 | 3829 | if (! (buf_ch >= 0400 |
| @@ -4498,7 +4499,7 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop) | |||
| 4498 | 4499 | ||
| 4499 | /* This is written out as an if-else so we don't waste time | 4500 | /* This is written out as an if-else so we don't waste time |
| 4500 | testing `translate' inside the loop. */ | 4501 | testing `translate' inside the loop. */ |
| 4501 | if (translate) | 4502 | if (RE_TRANSLATE_P (translate)) |
| 4502 | { | 4503 | { |
| 4503 | #ifdef emacs | 4504 | #ifdef emacs |
| 4504 | if (multibyte) | 4505 | if (multibyte) |
| @@ -4873,7 +4874,7 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop) | |||
| 4873 | 4874 | ||
| 4874 | /* Compare that many; failure if mismatch, else move | 4875 | /* Compare that many; failure if mismatch, else move |
| 4875 | past them. */ | 4876 | past them. */ |
| 4876 | if (translate | 4877 | if (RE_TRANSLATE_P (translate) |
| 4877 | ? bcmp_translate (d, d2, mcnt, translate) | 4878 | ? bcmp_translate (d, d2, mcnt, translate) |
| 4878 | : bcmp (d, d2, mcnt)) | 4879 | : bcmp (d, d2, mcnt)) |
| 4879 | goto fail; | 4880 | goto fail; |