diff options
| author | Paul Eggert | 2020-04-17 14:09:01 -0700 |
|---|---|---|
| committer | Paul Eggert | 2020-04-17 14:11:30 -0700 |
| commit | 2cb7e8669c3cdd0f7f0687e01810a3160d6b5c5b (patch) | |
| tree | 21fd3ca5914224a2478d7c528e68d0ca64ceddc1 /src/syntax.c | |
| parent | fadfde5fdf2fd8fc3b3b4ba430a954a89d0cd1fe (diff) | |
| download | emacs-2cb7e8669c3cdd0f7f0687e01810a3160d6b5c5b.tar.gz emacs-2cb7e8669c3cdd0f7f0687e01810a3160d6b5c5b.zip | |
Port recent character.h changes to --with-wide-int
* src/fns.c (mapcar1):
* src/keymap.c (Fkey_description):
* src/syntax.c (scan_lists):
Prefer ptrdiff_t to EMACS_INT where either will do; this fixes
newly-introduced type errors on --with-wide-int platforms where
ptrdiff_t is narrower than EMACS_INT.
* src/keymap.c (Fkey_description): Rework for clarity; remove goto.
* src/syntax.c (scan_words, Fforward_comment, scan_lists)):
Fix unlikely integer overflow problems that can occur on
--with-wide-int platforms, and that were caught by the recent
character.h changes.
Diffstat (limited to 'src/syntax.c')
| -rw-r--r-- | src/syntax.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/syntax.c b/src/syntax.c index bcf4dc07997..c765cc9a17b 100644 --- a/src/syntax.c +++ b/src/syntax.c | |||
| @@ -1441,7 +1441,7 @@ scan_words (ptrdiff_t from, EMACS_INT count) | |||
| 1441 | int ch0, ch1; | 1441 | int ch0, ch1; |
| 1442 | Lisp_Object func, pos; | 1442 | Lisp_Object func, pos; |
| 1443 | 1443 | ||
| 1444 | SETUP_SYNTAX_TABLE (from, count); | 1444 | SETUP_SYNTAX_TABLE (from, clip_to_bounds (PTRDIFF_MIN, count, PTRDIFF_MAX)); |
| 1445 | 1445 | ||
| 1446 | while (count > 0) | 1446 | while (count > 0) |
| 1447 | { | 1447 | { |
| @@ -2434,7 +2434,7 @@ between them, return t; otherwise return nil. */) | |||
| 2434 | from = PT; | 2434 | from = PT; |
| 2435 | from_byte = PT_BYTE; | 2435 | from_byte = PT_BYTE; |
| 2436 | 2436 | ||
| 2437 | SETUP_SYNTAX_TABLE (from, count1); | 2437 | SETUP_SYNTAX_TABLE (from, clip_to_bounds (PTRDIFF_MIN, count1, PTRDIFF_MAX)); |
| 2438 | while (count1 > 0) | 2438 | while (count1 > 0) |
| 2439 | { | 2439 | { |
| 2440 | do | 2440 | do |
| @@ -2624,7 +2624,7 @@ syntax_multibyte (int c, bool multibyte_symbol_p) | |||
| 2624 | } | 2624 | } |
| 2625 | 2625 | ||
| 2626 | static Lisp_Object | 2626 | static Lisp_Object |
| 2627 | scan_lists (EMACS_INT from, EMACS_INT count, EMACS_INT depth, bool sexpflag) | 2627 | scan_lists (EMACS_INT from0, EMACS_INT count, EMACS_INT depth, bool sexpflag) |
| 2628 | { | 2628 | { |
| 2629 | Lisp_Object val; | 2629 | Lisp_Object val; |
| 2630 | ptrdiff_t stop = count > 0 ? ZV : BEGV; | 2630 | ptrdiff_t stop = count > 0 ? ZV : BEGV; |
| @@ -2637,7 +2637,7 @@ scan_lists (EMACS_INT from, EMACS_INT count, EMACS_INT depth, bool sexpflag) | |||
| 2637 | int comstyle = 0; /* Style of comment encountered. */ | 2637 | int comstyle = 0; /* Style of comment encountered. */ |
| 2638 | bool comnested = 0; /* Whether the comment is nestable or not. */ | 2638 | bool comnested = 0; /* Whether the comment is nestable or not. */ |
| 2639 | ptrdiff_t temp_pos; | 2639 | ptrdiff_t temp_pos; |
| 2640 | EMACS_INT last_good = from; | 2640 | EMACS_INT last_good = from0; |
| 2641 | bool found; | 2641 | bool found; |
| 2642 | ptrdiff_t from_byte; | 2642 | ptrdiff_t from_byte; |
| 2643 | ptrdiff_t out_bytepos, out_charpos; | 2643 | ptrdiff_t out_bytepos, out_charpos; |
| @@ -2648,14 +2648,13 @@ scan_lists (EMACS_INT from, EMACS_INT count, EMACS_INT depth, bool sexpflag) | |||
| 2648 | 2648 | ||
| 2649 | if (depth > 0) min_depth = 0; | 2649 | if (depth > 0) min_depth = 0; |
| 2650 | 2650 | ||
| 2651 | if (from > ZV) from = ZV; | 2651 | ptrdiff_t from = clip_to_bounds (BEGV, from0, ZV); |
| 2652 | if (from < BEGV) from = BEGV; | ||
| 2653 | 2652 | ||
| 2654 | from_byte = CHAR_TO_BYTE (from); | 2653 | from_byte = CHAR_TO_BYTE (from); |
| 2655 | 2654 | ||
| 2656 | maybe_quit (); | 2655 | maybe_quit (); |
| 2657 | 2656 | ||
| 2658 | SETUP_SYNTAX_TABLE (from, count); | 2657 | SETUP_SYNTAX_TABLE (from, clip_to_bounds (PTRDIFF_MIN, count, PTRDIFF_MAX)); |
| 2659 | while (count > 0) | 2658 | while (count > 0) |
| 2660 | { | 2659 | { |
| 2661 | while (from < stop) | 2660 | while (from < stop) |