diff options
| author | Andrew Innes | 2000-10-24 14:00:55 +0000 |
|---|---|---|
| committer | Andrew Innes | 2000-10-24 14:00:55 +0000 |
| commit | 5b370c2bad5d308ab42ee63aa35835362782db75 (patch) | |
| tree | dfcf6d46a723fa75a085bb9cda28ff8e6030062c /src | |
| parent | 5dcab13e691fee1fbd8b3c842363a0587c74ce3b (diff) | |
| download | emacs-5b370c2bad5d308ab42ee63aa35835362782db75.tar.gz emacs-5b370c2bad5d308ab42ee63aa35835362782db75.zip | |
(IMMEDIATE_QUIT_CHECK): New macro, which does QUIT on
NT-Emacs only.
(re_match_2_internal): Use IMMEDIATE_QUIT_CHECK instead of QUIT,
so that re_search functions only quit when callers expect them to.
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 18ad636523c..fab989813d5 100644 --- a/src/regex.c +++ b/src/regex.c | |||
| @@ -2034,10 +2034,15 @@ re_wctype_to_bit (cc) | |||
| 2034 | } | 2034 | } |
| 2035 | #endif | 2035 | #endif |
| 2036 | 2036 | ||
| 2037 | /* QUIT is only used on NTemacs. */ | 2037 | /* Explicit quit checking is only used on NTemacs. */ |
| 2038 | #if !defined WINDOWSNT || !defined emacs || !defined QUIT | 2038 | #if defined WINDOWSNT && defined emacs && defined QUIT |
| 2039 | # undef QUIT | 2039 | extern int immediate_quit; |
| 2040 | # define QUIT | 2040 | # define IMMEDIATE_QUIT_CHECK \ |
| 2041 | do { \ | ||
| 2042 | if (immediate_quit) QUIT; \ | ||
| 2043 | } while (0) | ||
| 2044 | #else | ||
| 2045 | # define IMMEDIATE_QUIT_CHECK (0) | ||
| 2041 | #endif | 2046 | #endif |
| 2042 | 2047 | ||
| 2043 | #ifndef MATCH_MAY_ALLOCATE | 2048 | #ifndef MATCH_MAY_ALLOCATE |
| @@ -5291,7 +5296,7 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop) | |||
| 5291 | the repetition text and either the following jump or | 5296 | the repetition text and either the following jump or |
| 5292 | pop_failure_jump back to this on_failure_jump. */ | 5297 | pop_failure_jump back to this on_failure_jump. */ |
| 5293 | case on_failure_jump: | 5298 | case on_failure_jump: |
| 5294 | QUIT; | 5299 | IMMEDIATE_QUIT_CHECK; |
| 5295 | EXTRACT_NUMBER_AND_INCR (mcnt, p); | 5300 | EXTRACT_NUMBER_AND_INCR (mcnt, p); |
| 5296 | DEBUG_PRINT3 ("EXECUTING on_failure_jump %d (to %p):\n", | 5301 | DEBUG_PRINT3 ("EXECUTING on_failure_jump %d (to %p):\n", |
| 5297 | mcnt, p + mcnt); | 5302 | mcnt, p + mcnt); |
| @@ -5307,7 +5312,7 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop) | |||
| 5307 | then we can use a non-backtracking loop based on | 5312 | then we can use a non-backtracking loop based on |
| 5308 | on_failure_keep_string_jump instead of on_failure_jump. */ | 5313 | on_failure_keep_string_jump instead of on_failure_jump. */ |
| 5309 | case on_failure_jump_smart: | 5314 | case on_failure_jump_smart: |
| 5310 | QUIT; | 5315 | IMMEDIATE_QUIT_CHECK; |
| 5311 | EXTRACT_NUMBER_AND_INCR (mcnt, p); | 5316 | EXTRACT_NUMBER_AND_INCR (mcnt, p); |
| 5312 | DEBUG_PRINT3 ("EXECUTING on_failure_jump_smart %d (to %p).\n", | 5317 | DEBUG_PRINT3 ("EXECUTING on_failure_jump_smart %d (to %p).\n", |
| 5313 | mcnt, p + mcnt); | 5318 | mcnt, p + mcnt); |
| @@ -5345,7 +5350,7 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop) | |||
| 5345 | /* Unconditionally jump (without popping any failure points). */ | 5350 | /* Unconditionally jump (without popping any failure points). */ |
| 5346 | case jump: | 5351 | case jump: |
| 5347 | unconditional_jump: | 5352 | unconditional_jump: |
| 5348 | QUIT; | 5353 | IMMEDIATE_QUIT_CHECK; |
| 5349 | EXTRACT_NUMBER_AND_INCR (mcnt, p); /* Get the amount to jump. */ | 5354 | EXTRACT_NUMBER_AND_INCR (mcnt, p); /* Get the amount to jump. */ |
| 5350 | DEBUG_PRINT2 ("EXECUTING jump %d ", mcnt); | 5355 | DEBUG_PRINT2 ("EXECUTING jump %d ", mcnt); |
| 5351 | p += mcnt; /* Do the jump. */ | 5356 | p += mcnt; /* Do the jump. */ |
| @@ -5599,7 +5604,7 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop) | |||
| 5599 | 5604 | ||
| 5600 | /* We goto here if a matching operation fails. */ | 5605 | /* We goto here if a matching operation fails. */ |
| 5601 | fail: | 5606 | fail: |
| 5602 | QUIT; | 5607 | IMMEDIATE_QUIT_CHECK; |
| 5603 | if (!FAIL_STACK_EMPTY ()) | 5608 | if (!FAIL_STACK_EMPTY ()) |
| 5604 | { | 5609 | { |
| 5605 | re_char *str; | 5610 | re_char *str; |