diff options
| author | Paul Eggert | 2017-02-01 15:18:44 -0800 |
|---|---|---|
| committer | Paul Eggert | 2017-02-01 15:23:19 -0800 |
| commit | b4c9f9120d8b0da0593f2fbde69b40374f56451d (patch) | |
| tree | 8f40be80730a41e83e58e0632ff539ac752eb453 /src | |
| parent | b01ac672be1277833964d2d53f6dd26560c70343 (diff) | |
| download | emacs-b4c9f9120d8b0da0593f2fbde69b40374f56451d.tar.gz emacs-b4c9f9120d8b0da0593f2fbde69b40374f56451d.zip | |
Fix quitting bug when buffers are frozen
Problem noted by Eli Zaretskii in:
http://lists.gnu.org/archive/html/emacs-devel/2017-01/msg00721.html
This patch also fixes some other issues in that report.
* src/lisp.h (incr_rarely_quit): Remove.
All callers changed to use rarely_quit directly.
* src/search.c (freeze_buffer_relocation)
(thaw_buffer_relocation): New functions.
(looking_at_1, fast_looking_at, search_buffer):
Use them to fix bug when quitting when buffers are frozen.
* src/sysdep.c (emacs_intr_read): Rename from emacs_nointr_read.
All uses changed.
Diffstat (limited to 'src')
| -rw-r--r-- | src/callproc.c | 3 | ||||
| -rw-r--r-- | src/fns.c | 32 | ||||
| -rw-r--r-- | src/indent.c | 6 | ||||
| -rw-r--r-- | src/lisp.h | 8 | ||||
| -rw-r--r-- | src/search.c | 57 | ||||
| -rw-r--r-- | src/syntax.c | 34 | ||||
| -rw-r--r-- | src/sysdep.c | 10 |
7 files changed, 70 insertions, 80 deletions
diff --git a/src/callproc.c b/src/callproc.c index 710174c46b0..84324c48dcf 100644 --- a/src/callproc.c +++ b/src/callproc.c | |||
| @@ -198,7 +198,10 @@ call_process_cleanup (Lisp_Object buffer) | |||
| 198 | { | 198 | { |
| 199 | kill (-synch_process_pid, SIGINT); | 199 | kill (-synch_process_pid, SIGINT); |
| 200 | message1 ("Waiting for process to die...(type C-g again to kill it instantly)"); | 200 | message1 ("Waiting for process to die...(type C-g again to kill it instantly)"); |
| 201 | |||
| 202 | /* This will quit on C-g. */ | ||
| 201 | wait_for_termination (synch_process_pid, 0, 1); | 203 | wait_for_termination (synch_process_pid, 0, 1); |
| 204 | |||
| 202 | synch_process_pid = 0; | 205 | synch_process_pid = 0; |
| 203 | message1 ("Waiting for process to die...done"); | 206 | message1 ("Waiting for process to die...done"); |
| 204 | } | 207 | } |
| @@ -1389,7 +1389,7 @@ The value is actually the tail of LIST whose car is ELT. */) | |||
| 1389 | { | 1389 | { |
| 1390 | if (! NILP (Fequal (elt, XCAR (tail)))) | 1390 | if (! NILP (Fequal (elt, XCAR (tail)))) |
| 1391 | return tail; | 1391 | return tail; |
| 1392 | incr_rarely_quit (&quit_count); | 1392 | rarely_quit (++quit_count); |
| 1393 | } | 1393 | } |
| 1394 | CHECK_LIST_END (tail, list); | 1394 | CHECK_LIST_END (tail, list); |
| 1395 | return Qnil; | 1395 | return Qnil; |
| @@ -1406,7 +1406,7 @@ The value is actually the tail of LIST whose car is ELT. */) | |||
| 1406 | { | 1406 | { |
| 1407 | if (EQ (XCAR (tail), elt)) | 1407 | if (EQ (XCAR (tail), elt)) |
| 1408 | return tail; | 1408 | return tail; |
| 1409 | incr_rarely_quit (&quit_count); | 1409 | rarely_quit (++quit_count); |
| 1410 | } | 1410 | } |
| 1411 | CHECK_LIST_END (tail, list); | 1411 | CHECK_LIST_END (tail, list); |
| 1412 | return Qnil; | 1412 | return Qnil; |
| @@ -1427,7 +1427,7 @@ The value is actually the tail of LIST whose car is ELT. */) | |||
| 1427 | Lisp_Object tem = XCAR (tail); | 1427 | Lisp_Object tem = XCAR (tail); |
| 1428 | if (FLOATP (tem) && internal_equal (elt, tem, 0, 0, Qnil)) | 1428 | if (FLOATP (tem) && internal_equal (elt, tem, 0, 0, Qnil)) |
| 1429 | return tail; | 1429 | return tail; |
| 1430 | incr_rarely_quit (&quit_count); | 1430 | rarely_quit (++quit_count); |
| 1431 | } | 1431 | } |
| 1432 | CHECK_LIST_END (tail, list); | 1432 | CHECK_LIST_END (tail, list); |
| 1433 | return Qnil; | 1433 | return Qnil; |
| @@ -1445,7 +1445,7 @@ Elements of LIST that are not conses are ignored. */) | |||
| 1445 | { | 1445 | { |
| 1446 | if (CONSP (XCAR (tail)) && EQ (XCAR (XCAR (tail)), key)) | 1446 | if (CONSP (XCAR (tail)) && EQ (XCAR (XCAR (tail)), key)) |
| 1447 | return XCAR (tail); | 1447 | return XCAR (tail); |
| 1448 | incr_rarely_quit (&quit_count); | 1448 | rarely_quit (++quit_count); |
| 1449 | } | 1449 | } |
| 1450 | CHECK_LIST_END (tail, list); | 1450 | CHECK_LIST_END (tail, list); |
| 1451 | return Qnil; | 1451 | return Qnil; |
| @@ -1476,7 +1476,7 @@ The value is actually the first element of LIST whose car equals KEY. */) | |||
| 1476 | if (CONSP (car) | 1476 | if (CONSP (car) |
| 1477 | && (EQ (XCAR (car), key) || !NILP (Fequal (XCAR (car), key)))) | 1477 | && (EQ (XCAR (car), key) || !NILP (Fequal (XCAR (car), key)))) |
| 1478 | return car; | 1478 | return car; |
| 1479 | incr_rarely_quit (&quit_count); | 1479 | rarely_quit (++quit_count); |
| 1480 | } | 1480 | } |
| 1481 | CHECK_LIST_END (tail, list); | 1481 | CHECK_LIST_END (tail, list); |
| 1482 | return Qnil; | 1482 | return Qnil; |
| @@ -1509,7 +1509,7 @@ The value is actually the first element of LIST whose cdr is KEY. */) | |||
| 1509 | { | 1509 | { |
| 1510 | if (CONSP (XCAR (tail)) && EQ (XCDR (XCAR (tail)), key)) | 1510 | if (CONSP (XCAR (tail)) && EQ (XCDR (XCAR (tail)), key)) |
| 1511 | return XCAR (tail); | 1511 | return XCAR (tail); |
| 1512 | incr_rarely_quit (&quit_count); | 1512 | rarely_quit (++quit_count); |
| 1513 | } | 1513 | } |
| 1514 | CHECK_LIST_END (tail, list); | 1514 | CHECK_LIST_END (tail, list); |
| 1515 | return Qnil; | 1515 | return Qnil; |
| @@ -1528,7 +1528,7 @@ The value is actually the first element of LIST whose cdr equals KEY. */) | |||
| 1528 | if (CONSP (car) | 1528 | if (CONSP (car) |
| 1529 | && (EQ (XCDR (car), key) || !NILP (Fequal (XCDR (car), key)))) | 1529 | && (EQ (XCDR (car), key) || !NILP (Fequal (XCDR (car), key)))) |
| 1530 | return car; | 1530 | return car; |
| 1531 | incr_rarely_quit (&quit_count); | 1531 | rarely_quit (++quit_count); |
| 1532 | } | 1532 | } |
| 1533 | CHECK_LIST_END (tail, list); | 1533 | CHECK_LIST_END (tail, list); |
| 1534 | return Qnil; | 1534 | return Qnil; |
| @@ -1684,7 +1684,7 @@ changing the value of a sequence `foo'. */) | |||
| 1684 | } | 1684 | } |
| 1685 | else | 1685 | else |
| 1686 | prev = tail; | 1686 | prev = tail; |
| 1687 | incr_rarely_quit (&quit_count); | 1687 | rarely_quit (++quit_count); |
| 1688 | } | 1688 | } |
| 1689 | CHECK_LIST_END (tail, seq); | 1689 | CHECK_LIST_END (tail, seq); |
| 1690 | } | 1690 | } |
| @@ -1712,7 +1712,7 @@ This function may destructively modify SEQ to produce the value. */) | |||
| 1712 | next = XCDR (tail); | 1712 | next = XCDR (tail); |
| 1713 | Fsetcdr (tail, prev); | 1713 | Fsetcdr (tail, prev); |
| 1714 | prev = tail; | 1714 | prev = tail; |
| 1715 | incr_rarely_quit (&quit_count); | 1715 | rarely_quit (++quit_count); |
| 1716 | } | 1716 | } |
| 1717 | CHECK_LIST_END (tail, seq); | 1717 | CHECK_LIST_END (tail, seq); |
| 1718 | seq = prev; | 1718 | seq = prev; |
| @@ -1759,7 +1759,7 @@ See also the function `nreverse', which is used more often. */) | |||
| 1759 | for (new = Qnil; CONSP (seq); seq = XCDR (seq)) | 1759 | for (new = Qnil; CONSP (seq); seq = XCDR (seq)) |
| 1760 | { | 1760 | { |
| 1761 | new = Fcons (XCAR (seq), new); | 1761 | new = Fcons (XCAR (seq), new); |
| 1762 | incr_rarely_quit (&quit_count); | 1762 | rarely_quit (++quit_count); |
| 1763 | } | 1763 | } |
| 1764 | CHECK_LIST_END (seq, seq); | 1764 | CHECK_LIST_END (seq, seq); |
| 1765 | } | 1765 | } |
| @@ -2062,7 +2062,7 @@ The PLIST is modified by side effects. */) | |||
| 2062 | } | 2062 | } |
| 2063 | 2063 | ||
| 2064 | prev = tail; | 2064 | prev = tail; |
| 2065 | incr_rarely_quit (&quit_count); | 2065 | rarely_quit (++quit_count); |
| 2066 | } | 2066 | } |
| 2067 | Lisp_Object newcell | 2067 | Lisp_Object newcell |
| 2068 | = Fcons (prop, Fcons (val, NILP (prev) ? plist : XCDR (XCDR (prev)))); | 2068 | = Fcons (prop, Fcons (val, NILP (prev) ? plist : XCDR (XCDR (prev)))); |
| @@ -2100,7 +2100,7 @@ one of the properties on the list. */) | |||
| 2100 | { | 2100 | { |
| 2101 | if (! NILP (Fequal (prop, XCAR (tail)))) | 2101 | if (! NILP (Fequal (prop, XCAR (tail)))) |
| 2102 | return XCAR (XCDR (tail)); | 2102 | return XCAR (XCDR (tail)); |
| 2103 | incr_rarely_quit (&quit_count); | 2103 | rarely_quit (++quit_count); |
| 2104 | } | 2104 | } |
| 2105 | 2105 | ||
| 2106 | CHECK_LIST_END (tail, prop); | 2106 | CHECK_LIST_END (tail, prop); |
| @@ -2130,7 +2130,7 @@ The PLIST is modified by side effects. */) | |||
| 2130 | } | 2130 | } |
| 2131 | 2131 | ||
| 2132 | prev = tail; | 2132 | prev = tail; |
| 2133 | incr_rarely_quit (&quit_count); | 2133 | rarely_quit (++quit_count); |
| 2134 | } | 2134 | } |
| 2135 | Lisp_Object newcell = list2 (prop, val); | 2135 | Lisp_Object newcell = list2 (prop, val); |
| 2136 | if (NILP (prev)) | 2136 | if (NILP (prev)) |
| @@ -2210,7 +2210,7 @@ internal_equal (Lisp_Object o1, Lisp_Object o2, int depth, bool props, | |||
| 2210 | 2210 | ||
| 2211 | unsigned short int quit_count = 0; | 2211 | unsigned short int quit_count = 0; |
| 2212 | tail_recurse: | 2212 | tail_recurse: |
| 2213 | incr_rarely_quit (&quit_count); | 2213 | rarely_quit (++quit_count); |
| 2214 | if (EQ (o1, o2)) | 2214 | if (EQ (o1, o2)) |
| 2215 | return 1; | 2215 | return 1; |
| 2216 | if (XTYPE (o1) != XTYPE (o2)) | 2216 | if (XTYPE (o1) != XTYPE (o2)) |
| @@ -2419,7 +2419,7 @@ usage: (nconc &rest LISTS) */) | |||
| 2419 | { | 2419 | { |
| 2420 | tail = tem; | 2420 | tail = tem; |
| 2421 | tem = XCDR (tail); | 2421 | tem = XCDR (tail); |
| 2422 | incr_rarely_quit (&quit_count); | 2422 | rarely_quit (++quit_count); |
| 2423 | } | 2423 | } |
| 2424 | while (CONSP (tem)); | 2424 | while (CONSP (tem)); |
| 2425 | 2425 | ||
| @@ -2848,7 +2848,7 @@ The value is actually the tail of PLIST whose car is PROP. */) | |||
| 2848 | { | 2848 | { |
| 2849 | plist = XCDR (plist); | 2849 | plist = XCDR (plist); |
| 2850 | plist = CDR (plist); | 2850 | plist = CDR (plist); |
| 2851 | incr_rarely_quit (&quit_count); | 2851 | rarely_quit (++quit_count); |
| 2852 | } | 2852 | } |
| 2853 | return plist; | 2853 | return plist; |
| 2854 | } | 2854 | } |
diff --git a/src/indent.c b/src/indent.c index aff14abfd20..f630ebb847c 100644 --- a/src/indent.c +++ b/src/indent.c | |||
| @@ -1215,7 +1215,7 @@ compute_motion (ptrdiff_t from, ptrdiff_t frombyte, EMACS_INT fromvpos, | |||
| 1215 | 1215 | ||
| 1216 | while (true) | 1216 | while (true) |
| 1217 | { | 1217 | { |
| 1218 | incr_rarely_quit (&quit_count); | 1218 | rarely_quit (++quit_count); |
| 1219 | 1219 | ||
| 1220 | while (pos == next_boundary) | 1220 | while (pos == next_boundary) |
| 1221 | { | 1221 | { |
| @@ -1282,7 +1282,7 @@ compute_motion (ptrdiff_t from, ptrdiff_t frombyte, EMACS_INT fromvpos, | |||
| 1282 | pos_byte = CHAR_TO_BYTE (pos); | 1282 | pos_byte = CHAR_TO_BYTE (pos); |
| 1283 | } | 1283 | } |
| 1284 | 1284 | ||
| 1285 | incr_rarely_quit (&quit_count); | 1285 | rarely_quit (++quit_count); |
| 1286 | } | 1286 | } |
| 1287 | 1287 | ||
| 1288 | /* Handle right margin. */ | 1288 | /* Handle right margin. */ |
| @@ -1605,7 +1605,7 @@ compute_motion (ptrdiff_t from, ptrdiff_t frombyte, EMACS_INT fromvpos, | |||
| 1605 | pos = find_before_next_newline (pos, to, 1, &pos_byte); | 1605 | pos = find_before_next_newline (pos, to, 1, &pos_byte); |
| 1606 | if (pos < to) | 1606 | if (pos < to) |
| 1607 | INC_BOTH (pos, pos_byte); | 1607 | INC_BOTH (pos, pos_byte); |
| 1608 | incr_rarely_quit (&quit_count); | 1608 | rarely_quit (++quit_count); |
| 1609 | } | 1609 | } |
| 1610 | while (pos < to | 1610 | while (pos < to |
| 1611 | && indented_beyond_p (pos, pos_byte, | 1611 | && indented_beyond_p (pos, pos_byte, |
diff --git a/src/lisp.h b/src/lisp.h index 2d67e7edddb..1ac38164c27 100644 --- a/src/lisp.h +++ b/src/lisp.h | |||
| @@ -3145,14 +3145,6 @@ rarely_quit (unsigned short int count) | |||
| 3145 | if (! (count & (QUIT_COUNT_HEURISTIC - 1))) | 3145 | if (! (count & (QUIT_COUNT_HEURISTIC - 1))) |
| 3146 | maybe_quit (); | 3146 | maybe_quit (); |
| 3147 | } | 3147 | } |
| 3148 | |||
| 3149 | /* Increment *QUIT_COUNT and rarely quit. */ | ||
| 3150 | |||
| 3151 | INLINE void | ||
| 3152 | incr_rarely_quit (unsigned short int *quit_count) | ||
| 3153 | { | ||
| 3154 | rarely_quit (++*quit_count); | ||
| 3155 | } | ||
| 3156 | 3148 | ||
| 3157 | extern Lisp_Object Vascii_downcase_table; | 3149 | extern Lisp_Object Vascii_downcase_table; |
| 3158 | extern Lisp_Object Vascii_canon_table; | 3150 | extern Lisp_Object Vascii_canon_table; |
diff --git a/src/search.c b/src/search.c index 084adda097b..33cb02aa7af 100644 --- a/src/search.c +++ b/src/search.c | |||
| @@ -99,6 +99,25 @@ matcher_overflow (void) | |||
| 99 | error ("Stack overflow in regexp matcher"); | 99 | error ("Stack overflow in regexp matcher"); |
| 100 | } | 100 | } |
| 101 | 101 | ||
| 102 | static void | ||
| 103 | freeze_buffer_relocation (void) | ||
| 104 | { | ||
| 105 | #ifdef REL_ALLOC | ||
| 106 | /* Prevent ralloc.c from relocating the current buffer while | ||
| 107 | searching it. */ | ||
| 108 | r_alloc_inhibit_buffer_relocation (1); | ||
| 109 | record_unwind_protect_int (r_alloc_inhibit_buffer_relocation, 0); | ||
| 110 | #endif | ||
| 111 | } | ||
| 112 | |||
| 113 | static void | ||
| 114 | thaw_buffer_relocation (void) | ||
| 115 | { | ||
| 116 | #ifdef REL_ALLOC | ||
| 117 | unbind_to (SPECPDL_INDEX () - 1, Qnil); | ||
| 118 | #endif | ||
| 119 | } | ||
| 120 | |||
| 102 | /* Compile a regexp and signal a Lisp error if anything goes wrong. | 121 | /* Compile a regexp and signal a Lisp error if anything goes wrong. |
| 103 | PATTERN is the pattern to compile. | 122 | PATTERN is the pattern to compile. |
| 104 | CP is the place to put the result. | 123 | CP is the place to put the result. |
| @@ -300,19 +319,13 @@ looking_at_1 (Lisp_Object string, bool posix) | |||
| 300 | 319 | ||
| 301 | re_match_object = Qnil; | 320 | re_match_object = Qnil; |
| 302 | 321 | ||
| 303 | #ifdef REL_ALLOC | 322 | freeze_buffer_relocation (); |
| 304 | /* Prevent ralloc.c from relocating the current buffer while | ||
| 305 | searching it. */ | ||
| 306 | r_alloc_inhibit_buffer_relocation (1); | ||
| 307 | #endif | ||
| 308 | i = re_match_2 (bufp, (char *) p1, s1, (char *) p2, s2, | 323 | i = re_match_2 (bufp, (char *) p1, s1, (char *) p2, s2, |
| 309 | PT_BYTE - BEGV_BYTE, | 324 | PT_BYTE - BEGV_BYTE, |
| 310 | (NILP (Vinhibit_changing_match_data) | 325 | (NILP (Vinhibit_changing_match_data) |
| 311 | ? &search_regs : NULL), | 326 | ? &search_regs : NULL), |
| 312 | ZV_BYTE - BEGV_BYTE); | 327 | ZV_BYTE - BEGV_BYTE); |
| 313 | #ifdef REL_ALLOC | 328 | thaw_buffer_relocation (); |
| 314 | r_alloc_inhibit_buffer_relocation (0); | ||
| 315 | #endif | ||
| 316 | 329 | ||
| 317 | if (i == -2) | 330 | if (i == -2) |
| 318 | matcher_overflow (); | 331 | matcher_overflow (); |
| @@ -553,16 +566,10 @@ fast_looking_at (Lisp_Object regexp, ptrdiff_t pos, ptrdiff_t pos_byte, | |||
| 553 | } | 566 | } |
| 554 | 567 | ||
| 555 | buf = compile_pattern (regexp, 0, Qnil, 0, multibyte); | 568 | buf = compile_pattern (regexp, 0, Qnil, 0, multibyte); |
| 556 | #ifdef REL_ALLOC | 569 | freeze_buffer_relocation (); |
| 557 | /* Prevent ralloc.c from relocating the current buffer while | ||
| 558 | searching it. */ | ||
| 559 | r_alloc_inhibit_buffer_relocation (1); | ||
| 560 | #endif | ||
| 561 | len = re_match_2 (buf, (char *) p1, s1, (char *) p2, s2, | 570 | len = re_match_2 (buf, (char *) p1, s1, (char *) p2, s2, |
| 562 | pos_byte, NULL, limit_byte); | 571 | pos_byte, NULL, limit_byte); |
| 563 | #ifdef REL_ALLOC | 572 | thaw_buffer_relocation (); |
| 564 | r_alloc_inhibit_buffer_relocation (0); | ||
| 565 | #endif | ||
| 566 | 573 | ||
| 567 | return len; | 574 | return len; |
| 568 | } | 575 | } |
| @@ -1204,11 +1211,7 @@ search_buffer (Lisp_Object string, ptrdiff_t pos, ptrdiff_t pos_byte, | |||
| 1204 | } | 1211 | } |
| 1205 | re_match_object = Qnil; | 1212 | re_match_object = Qnil; |
| 1206 | 1213 | ||
| 1207 | #ifdef REL_ALLOC | 1214 | freeze_buffer_relocation (); |
| 1208 | /* Prevent ralloc.c from relocating the current buffer while | ||
| 1209 | searching it. */ | ||
| 1210 | r_alloc_inhibit_buffer_relocation (1); | ||
| 1211 | #endif | ||
| 1212 | 1215 | ||
| 1213 | while (n < 0) | 1216 | while (n < 0) |
| 1214 | { | 1217 | { |
| @@ -1250,9 +1253,7 @@ search_buffer (Lisp_Object string, ptrdiff_t pos, ptrdiff_t pos_byte, | |||
| 1250 | } | 1253 | } |
| 1251 | else | 1254 | else |
| 1252 | { | 1255 | { |
| 1253 | #ifdef REL_ALLOC | 1256 | thaw_buffer_relocation (); |
| 1254 | r_alloc_inhibit_buffer_relocation (0); | ||
| 1255 | #endif | ||
| 1256 | return (n); | 1257 | return (n); |
| 1257 | } | 1258 | } |
| 1258 | n++; | 1259 | n++; |
| @@ -1295,17 +1296,13 @@ search_buffer (Lisp_Object string, ptrdiff_t pos, ptrdiff_t pos_byte, | |||
| 1295 | } | 1296 | } |
| 1296 | else | 1297 | else |
| 1297 | { | 1298 | { |
| 1298 | #ifdef REL_ALLOC | 1299 | thaw_buffer_relocation (); |
| 1299 | r_alloc_inhibit_buffer_relocation (0); | ||
| 1300 | #endif | ||
| 1301 | return (0 - n); | 1300 | return (0 - n); |
| 1302 | } | 1301 | } |
| 1303 | n--; | 1302 | n--; |
| 1304 | maybe_quit (); | 1303 | maybe_quit (); |
| 1305 | } | 1304 | } |
| 1306 | #ifdef REL_ALLOC | 1305 | thaw_buffer_relocation (); |
| 1307 | r_alloc_inhibit_buffer_relocation (0); | ||
| 1308 | #endif | ||
| 1309 | return (pos); | 1306 | return (pos); |
| 1310 | } | 1307 | } |
| 1311 | else /* non-RE case */ | 1308 | else /* non-RE case */ |
diff --git a/src/syntax.c b/src/syntax.c index 06fe50b866b..7aa43e6e5c7 100644 --- a/src/syntax.c +++ b/src/syntax.c | |||
| @@ -593,7 +593,6 @@ static ptrdiff_t | |||
| 593 | find_defun_start (ptrdiff_t pos, ptrdiff_t pos_byte) | 593 | find_defun_start (ptrdiff_t pos, ptrdiff_t pos_byte) |
| 594 | { | 594 | { |
| 595 | ptrdiff_t opoint = PT, opoint_byte = PT_BYTE; | 595 | ptrdiff_t opoint = PT, opoint_byte = PT_BYTE; |
| 596 | unsigned short int quit_count = 0; | ||
| 597 | 596 | ||
| 598 | /* Use previous finding, if it's valid and applies to this inquiry. */ | 597 | /* Use previous finding, if it's valid and applies to this inquiry. */ |
| 599 | if (current_buffer == find_start_buffer | 598 | if (current_buffer == find_start_buffer |
| @@ -636,7 +635,6 @@ find_defun_start (ptrdiff_t pos, ptrdiff_t pos_byte) | |||
| 636 | } | 635 | } |
| 637 | /* Move to beg of previous line. */ | 636 | /* Move to beg of previous line. */ |
| 638 | scan_newline (PT, PT_BYTE, BEGV, BEGV_BYTE, -2, 1); | 637 | scan_newline (PT, PT_BYTE, BEGV, BEGV_BYTE, -2, 1); |
| 639 | incr_rarely_quit (&quit_count); | ||
| 640 | } | 638 | } |
| 641 | 639 | ||
| 642 | /* Record what we found, for the next try. */ | 640 | /* Record what we found, for the next try. */ |
| @@ -725,7 +723,7 @@ back_comment (ptrdiff_t from, ptrdiff_t from_byte, ptrdiff_t stop, | |||
| 725 | that determines quote parity to the comment-end. */ | 723 | that determines quote parity to the comment-end. */ |
| 726 | while (from != stop) | 724 | while (from != stop) |
| 727 | { | 725 | { |
| 728 | incr_rarely_quit (&quit_count); | 726 | rarely_quit (++quit_count); |
| 729 | 727 | ||
| 730 | ptrdiff_t temp_byte; | 728 | ptrdiff_t temp_byte; |
| 731 | int prev_syntax; | 729 | int prev_syntax; |
| @@ -954,7 +952,7 @@ back_comment (ptrdiff_t from, ptrdiff_t from_byte, ptrdiff_t stop, | |||
| 954 | defun_start_byte = CHAR_TO_BYTE (defun_start); | 952 | defun_start_byte = CHAR_TO_BYTE (defun_start); |
| 955 | } | 953 | } |
| 956 | } | 954 | } |
| 957 | incr_rarely_quit (&quit_count); | 955 | rarely_quit (++quit_count); |
| 958 | } | 956 | } |
| 959 | while (defun_start < comment_end); | 957 | while (defun_start < comment_end); |
| 960 | 958 | ||
| @@ -2386,7 +2384,7 @@ forw_comment (ptrdiff_t from, ptrdiff_t from_byte, ptrdiff_t stop, | |||
| 2386 | nesting++; | 2384 | nesting++; |
| 2387 | } | 2385 | } |
| 2388 | 2386 | ||
| 2389 | incr_rarely_quit (&quit_count); | 2387 | rarely_quit (++quit_count); |
| 2390 | } | 2388 | } |
| 2391 | *charpos_ptr = from; | 2389 | *charpos_ptr = from; |
| 2392 | *bytepos_ptr = from_byte; | 2390 | *bytepos_ptr = from_byte; |
| @@ -2460,7 +2458,7 @@ between them, return t; otherwise return nil. */) | |||
| 2460 | INC_BOTH (from, from_byte); | 2458 | INC_BOTH (from, from_byte); |
| 2461 | UPDATE_SYNTAX_TABLE_FORWARD (from); | 2459 | UPDATE_SYNTAX_TABLE_FORWARD (from); |
| 2462 | } | 2460 | } |
| 2463 | incr_rarely_quit (&quit_count); | 2461 | rarely_quit (++quit_count); |
| 2464 | } | 2462 | } |
| 2465 | while (code == Swhitespace || (code == Sendcomment && c == '\n')); | 2463 | while (code == Swhitespace || (code == Sendcomment && c == '\n')); |
| 2466 | 2464 | ||
| @@ -2544,7 +2542,7 @@ between them, return t; otherwise return nil. */) | |||
| 2544 | } | 2542 | } |
| 2545 | else if (from == stop) | 2543 | else if (from == stop) |
| 2546 | break; | 2544 | break; |
| 2547 | incr_rarely_quit (&quit_count); | 2545 | rarely_quit (++quit_count); |
| 2548 | } | 2546 | } |
| 2549 | if (fence_found == 0) | 2547 | if (fence_found == 0) |
| 2550 | { | 2548 | { |
| @@ -2592,7 +2590,7 @@ between them, return t; otherwise return nil. */) | |||
| 2592 | return Qnil; | 2590 | return Qnil; |
| 2593 | } | 2591 | } |
| 2594 | 2592 | ||
| 2595 | incr_rarely_quit (&quit_count); | 2593 | rarely_quit (++quit_count); |
| 2596 | } | 2594 | } |
| 2597 | 2595 | ||
| 2598 | count1++; | 2596 | count1++; |
| @@ -2648,7 +2646,7 @@ scan_lists (EMACS_INT from, EMACS_INT count, EMACS_INT depth, bool sexpflag) | |||
| 2648 | { | 2646 | { |
| 2649 | while (from < stop) | 2647 | while (from < stop) |
| 2650 | { | 2648 | { |
| 2651 | incr_rarely_quit (&quit_count); | 2649 | rarely_quit (++quit_count); |
| 2652 | bool comstart_first, prefix; | 2650 | bool comstart_first, prefix; |
| 2653 | int syntax, other_syntax; | 2651 | int syntax, other_syntax; |
| 2654 | UPDATE_SYNTAX_TABLE_FORWARD (from); | 2652 | UPDATE_SYNTAX_TABLE_FORWARD (from); |
| @@ -2717,7 +2715,7 @@ scan_lists (EMACS_INT from, EMACS_INT count, EMACS_INT depth, bool sexpflag) | |||
| 2717 | goto done; | 2715 | goto done; |
| 2718 | } | 2716 | } |
| 2719 | INC_BOTH (from, from_byte); | 2717 | INC_BOTH (from, from_byte); |
| 2720 | incr_rarely_quit (&quit_count); | 2718 | rarely_quit (++quit_count); |
| 2721 | } | 2719 | } |
| 2722 | goto done; | 2720 | goto done; |
| 2723 | 2721 | ||
| @@ -2789,7 +2787,7 @@ scan_lists (EMACS_INT from, EMACS_INT count, EMACS_INT depth, bool sexpflag) | |||
| 2789 | if (c_code == Scharquote || c_code == Sescape) | 2787 | if (c_code == Scharquote || c_code == Sescape) |
| 2790 | INC_BOTH (from, from_byte); | 2788 | INC_BOTH (from, from_byte); |
| 2791 | INC_BOTH (from, from_byte); | 2789 | INC_BOTH (from, from_byte); |
| 2792 | incr_rarely_quit (&quit_count); | 2790 | rarely_quit (++quit_count); |
| 2793 | } | 2791 | } |
| 2794 | INC_BOTH (from, from_byte); | 2792 | INC_BOTH (from, from_byte); |
| 2795 | if (!depth && sexpflag) goto done; | 2793 | if (!depth && sexpflag) goto done; |
| @@ -2815,7 +2813,7 @@ scan_lists (EMACS_INT from, EMACS_INT count, EMACS_INT depth, bool sexpflag) | |||
| 2815 | { | 2813 | { |
| 2816 | while (from > stop) | 2814 | while (from > stop) |
| 2817 | { | 2815 | { |
| 2818 | incr_rarely_quit (&quit_count); | 2816 | rarely_quit (++quit_count); |
| 2819 | DEC_BOTH (from, from_byte); | 2817 | DEC_BOTH (from, from_byte); |
| 2820 | UPDATE_SYNTAX_TABLE_BACKWARD (from); | 2818 | UPDATE_SYNTAX_TABLE_BACKWARD (from); |
| 2821 | c = FETCH_CHAR_AS_MULTIBYTE (from_byte); | 2819 | c = FETCH_CHAR_AS_MULTIBYTE (from_byte); |
| @@ -2891,7 +2889,7 @@ scan_lists (EMACS_INT from, EMACS_INT count, EMACS_INT depth, bool sexpflag) | |||
| 2891 | default: goto done2; | 2889 | default: goto done2; |
| 2892 | } | 2890 | } |
| 2893 | DEC_BOTH (from, from_byte); | 2891 | DEC_BOTH (from, from_byte); |
| 2894 | incr_rarely_quit (&quit_count); | 2892 | rarely_quit (++quit_count); |
| 2895 | } | 2893 | } |
| 2896 | goto done2; | 2894 | goto done2; |
| 2897 | 2895 | ||
| @@ -2954,7 +2952,7 @@ scan_lists (EMACS_INT from, EMACS_INT count, EMACS_INT depth, bool sexpflag) | |||
| 2954 | if (syntax_multibyte (c, multibyte_symbol_p) == code) | 2952 | if (syntax_multibyte (c, multibyte_symbol_p) == code) |
| 2955 | break; | 2953 | break; |
| 2956 | } | 2954 | } |
| 2957 | incr_rarely_quit (&quit_count); | 2955 | rarely_quit (++quit_count); |
| 2958 | } | 2956 | } |
| 2959 | if (code == Sstring_fence && !depth && sexpflag) goto done2; | 2957 | if (code == Sstring_fence && !depth && sexpflag) goto done2; |
| 2960 | break; | 2958 | break; |
| @@ -2975,7 +2973,7 @@ scan_lists (EMACS_INT from, EMACS_INT count, EMACS_INT depth, bool sexpflag) | |||
| 2975 | == Sstring)) | 2973 | == Sstring)) |
| 2976 | break; | 2974 | break; |
| 2977 | } | 2975 | } |
| 2978 | incr_rarely_quit (&quit_count); | 2976 | rarely_quit (++quit_count); |
| 2979 | } | 2977 | } |
| 2980 | if (!depth && sexpflag) goto done2; | 2978 | if (!depth && sexpflag) goto done2; |
| 2981 | break; | 2979 | break; |
| @@ -3229,7 +3227,7 @@ do { prev_from = from; \ | |||
| 3229 | 3227 | ||
| 3230 | while (from < end) | 3228 | while (from < end) |
| 3231 | { | 3229 | { |
| 3232 | incr_rarely_quit (&quit_count); | 3230 | rarely_quit (++quit_count); |
| 3233 | INC_FROM; | 3231 | INC_FROM; |
| 3234 | 3232 | ||
| 3235 | if ((from < end) | 3233 | if ((from < end) |
| @@ -3286,7 +3284,7 @@ do { prev_from = from; \ | |||
| 3286 | goto symdone; | 3284 | goto symdone; |
| 3287 | } | 3285 | } |
| 3288 | INC_FROM; | 3286 | INC_FROM; |
| 3289 | incr_rarely_quit (&quit_count); | 3287 | rarely_quit (++quit_count); |
| 3290 | } | 3288 | } |
| 3291 | symdone: | 3289 | symdone: |
| 3292 | curlevel->prev = curlevel->last; | 3290 | curlevel->prev = curlevel->last; |
| @@ -3397,7 +3395,7 @@ do { prev_from = from; \ | |||
| 3397 | break; | 3395 | break; |
| 3398 | } | 3396 | } |
| 3399 | INC_FROM; | 3397 | INC_FROM; |
| 3400 | incr_rarely_quit (&quit_count); | 3398 | rarely_quit (++quit_count); |
| 3401 | } | 3399 | } |
| 3402 | } | 3400 | } |
| 3403 | string_end: | 3401 | string_end: |
diff --git a/src/sysdep.c b/src/sysdep.c index 4155c205712..91b2a5cb943 100644 --- a/src/sysdep.c +++ b/src/sysdep.c | |||
| @@ -2508,12 +2508,12 @@ emacs_close (int fd) | |||
| 2508 | #endif | 2508 | #endif |
| 2509 | 2509 | ||
| 2510 | /* Read from FD to a buffer BUF with size NBYTE. | 2510 | /* Read from FD to a buffer BUF with size NBYTE. |
| 2511 | If interrupted, either quit or retry the read. | 2511 | If interrupted, process any quits and pending signals immediately |
| 2512 | Process any quits and pending signals immediately if INTERRUPTIBLE. | 2512 | if INTERRUPTIBLE, and then retry the read unless quitting. |
| 2513 | Return the number of bytes read, which might be less than NBYTE. | 2513 | Return the number of bytes read, which might be less than NBYTE. |
| 2514 | On error, set errno to a value other than EINTR, and return -1. */ | 2514 | On error, set errno to a value other than EINTR, and return -1. */ |
| 2515 | static ptrdiff_t | 2515 | static ptrdiff_t |
| 2516 | emacs_nointr_read (int fd, void *buf, ptrdiff_t nbyte, bool interruptible) | 2516 | emacs_intr_read (int fd, void *buf, ptrdiff_t nbyte, bool interruptible) |
| 2517 | { | 2517 | { |
| 2518 | ssize_t result; | 2518 | ssize_t result; |
| 2519 | 2519 | ||
| @@ -2537,14 +2537,14 @@ emacs_nointr_read (int fd, void *buf, ptrdiff_t nbyte, bool interruptible) | |||
| 2537 | ptrdiff_t | 2537 | ptrdiff_t |
| 2538 | emacs_read (int fd, void *buf, ptrdiff_t nbyte) | 2538 | emacs_read (int fd, void *buf, ptrdiff_t nbyte) |
| 2539 | { | 2539 | { |
| 2540 | return emacs_nointr_read (fd, buf, nbyte, false); | 2540 | return emacs_intr_read (fd, buf, nbyte, false); |
| 2541 | } | 2541 | } |
| 2542 | 2542 | ||
| 2543 | /* Like emacs_read, but also process quits and pending signals. */ | 2543 | /* Like emacs_read, but also process quits and pending signals. */ |
| 2544 | ptrdiff_t | 2544 | ptrdiff_t |
| 2545 | emacs_read_quit (int fd, void *buf, ptrdiff_t nbyte) | 2545 | emacs_read_quit (int fd, void *buf, ptrdiff_t nbyte) |
| 2546 | { | 2546 | { |
| 2547 | return emacs_nointr_read (fd, buf, nbyte, true); | 2547 | return emacs_intr_read (fd, buf, nbyte, true); |
| 2548 | } | 2548 | } |
| 2549 | 2549 | ||
| 2550 | /* Write to FILEDES from a buffer BUF with size NBYTE, retrying if | 2550 | /* Write to FILEDES from a buffer BUF with size NBYTE, retrying if |