diff options
| author | Stefan Monnier | 2000-05-30 02:59:54 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2000-05-30 02:59:54 +0000 |
| commit | f1ad044f23348769bfe7309464b2004f2eae68b4 (patch) | |
| tree | c8a1035a6c578cd05d2df45e478cb315dec254a7 /src | |
| parent | 66254a13e20f808ca4a15452fc0516a056fd1d0b (diff) | |
| download | emacs-f1ad044f23348769bfe7309464b2004f2eae68b4.tar.gz emacs-f1ad044f23348769bfe7309464b2004f2eae68b4.zip | |
(PREFETCH_NOLIMIT): New function.
(re_match_2_internal): Use it and adjust the end_match_2 logic.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 5 | ||||
| -rw-r--r-- | src/regex.c | 29 |
2 files changed, 25 insertions, 9 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 6b5e24989a3..431d7c048a9 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2000-05-29 Stefan Monnier <monnier@cs.yale.edu> | ||
| 2 | |||
| 3 | * regex.c (PREFETCH_NOLIMIT): New function. | ||
| 4 | (re_match_2_internal): Use it and adjust the end_match_2 logic. | ||
| 5 | |||
| 1 | 2000-05-29 Gerd Moellmann <gerd@gnu.org> | 6 | 2000-05-29 Gerd Moellmann <gerd@gnu.org> |
| 2 | 7 | ||
| 3 | * syntax.c (find_defun_start): Move test for | 8 | * syntax.c (find_defun_start): Move test for |
diff --git a/src/regex.c b/src/regex.c index 9ea8699c331..df1b0b6d8a9 100644 --- a/src/regex.c +++ b/src/regex.c | |||
| @@ -3952,6 +3952,16 @@ static int bcmp_translate _RE_ARGS((re_char *s1, re_char *s2, | |||
| 3952 | dend = end_match_2; \ | 3952 | dend = end_match_2; \ |
| 3953 | } | 3953 | } |
| 3954 | 3954 | ||
| 3955 | /* Call before fetching a char with *d if you already checked other limits. | ||
| 3956 | This is meant for use in lookahead operations like wordend, etc.. | ||
| 3957 | where we might need to look at parts of the string that might be | ||
| 3958 | outside of the LIMITs (i.e past `stop'). */ | ||
| 3959 | #define PREFETCH_NOLIMIT() \ | ||
| 3960 | if (d == end1) \ | ||
| 3961 | { \ | ||
| 3962 | d = string2; \ | ||
| 3963 | dend = end_match_2; \ | ||
| 3964 | } \ | ||
| 3955 | 3965 | ||
| 3956 | /* Test if at very beginning or at very end of the virtual concatenation | 3966 | /* Test if at very beginning or at very end of the virtual concatenation |
| 3957 | of `string1' and `string2'. If only one string, it's `string2'. */ | 3967 | of `string1' and `string2'. If only one string, it's `string2'. */ |
| @@ -4497,7 +4507,7 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop) | |||
| 4497 | } | 4507 | } |
| 4498 | else | 4508 | else |
| 4499 | { | 4509 | { |
| 4500 | if (stop <= size1) | 4510 | if (stop < size1) |
| 4501 | { | 4511 | { |
| 4502 | /* Only match within string1. */ | 4512 | /* Only match within string1. */ |
| 4503 | end_match_1 = string1 + stop; | 4513 | end_match_1 = string1 + stop; |
| @@ -4512,7 +4522,9 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop) | |||
| 4512 | end_match_2 = end_match_1; | 4522 | end_match_2 = end_match_1; |
| 4513 | } | 4523 | } |
| 4514 | else | 4524 | else |
| 4515 | { | 4525 | { /* It's important to use this code when stop == size so that |
| 4526 | moving `d' from end1 to string2 will not prevent the d == dend | ||
| 4527 | check from catching the end of string. */ | ||
| 4516 | end_match_1 = end1; | 4528 | end_match_1 = end1; |
| 4517 | end_match_2 = string2 + stop - size1; | 4529 | end_match_2 = string2 + stop - size1; |
| 4518 | } | 4530 | } |
| @@ -5014,12 +5026,11 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop) | |||
| 5014 | { | 5026 | { |
| 5015 | if (!bufp->not_eol) break; | 5027 | if (!bufp->not_eol) break; |
| 5016 | } | 5028 | } |
| 5017 | 5029 | else | |
| 5018 | /* We have to ``prefetch'' the next character. */ | ||
| 5019 | else if ((d == end1 ? *string2 : *d) == '\n' | ||
| 5020 | && bufp->newline_anchor) | ||
| 5021 | { | 5030 | { |
| 5022 | break; | 5031 | PREFETCH_NOLIMIT (); |
| 5032 | if (*d == '\n' && bufp->newline_anchor) | ||
| 5033 | break; | ||
| 5023 | } | 5034 | } |
| 5024 | goto fail; | 5035 | goto fail; |
| 5025 | 5036 | ||
| @@ -5254,7 +5265,7 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop) | |||
| 5254 | #ifdef emacs | 5265 | #ifdef emacs |
| 5255 | UPDATE_SYNTAX_TABLE_FORWARD (charpos + 1); | 5266 | UPDATE_SYNTAX_TABLE_FORWARD (charpos + 1); |
| 5256 | #endif | 5267 | #endif |
| 5257 | PREFETCH (); | 5268 | PREFETCH_NOLIMIT (); |
| 5258 | c2 = RE_STRING_CHAR (d, dend - d); | 5269 | c2 = RE_STRING_CHAR (d, dend - d); |
| 5259 | s2 = SYNTAX (c2); | 5270 | s2 = SYNTAX (c2); |
| 5260 | 5271 | ||
| @@ -5341,7 +5352,7 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop) | |||
| 5341 | /* Case 3: D is not at the end of string ... */ | 5352 | /* Case 3: D is not at the end of string ... */ |
| 5342 | if (!AT_STRINGS_END (d)) | 5353 | if (!AT_STRINGS_END (d)) |
| 5343 | { | 5354 | { |
| 5344 | PREFETCH (); | 5355 | PREFETCH_NOLIMIT (); |
| 5345 | c2 = RE_STRING_CHAR (d, dend - d); | 5356 | c2 = RE_STRING_CHAR (d, dend - d); |
| 5346 | #ifdef emacs | 5357 | #ifdef emacs |
| 5347 | UPDATE_SYNTAX_TABLE_FORWARD (charpos); | 5358 | UPDATE_SYNTAX_TABLE_FORWARD (charpos); |