diff options
| author | Paul Eggert | 2020-03-27 00:58:31 -0700 |
|---|---|---|
| committer | Paul Eggert | 2020-03-27 01:06:54 -0700 |
| commit | de00a933e4b35b42398582eaba58531e5fdd46ca (patch) | |
| tree | 1999aba74c99e98e2b101faf65160acb45fd9b52 /src/fns.c | |
| parent | 10bedb75c915158b7662d4dfa4afa3a231714268 (diff) | |
| download | emacs-de00a933e4b35b42398582eaba58531e5fdd46ca.tar.gz emacs-de00a933e4b35b42398582eaba58531e5fdd46ca.zip | |
Treat out-of-range positions consistently
If a position argument to get-byte etc. is an out-of-range integer,
treat it the same regardless of whether it is a fixnum or a bignum.
* src/buffer.c (fix_position): New function.
* src/buffer.c (validate_region):
* src/character.c (Fget_byte):
* src/coding.c (Ffind_coding_systems_region_internal)
(Fcheck_coding_systems_region):
* src/composite.c (Ffind_composition_internal):
* src/editfns.c (Fposition_bytes, Fchar_after, Fchar_before)
(Finsert_buffer_substring, Fcompare_buffer_substrings)
(Fnarrow_to_region):
* src/fns.c (Fsecure_hash_algorithms):
* src/font.c (Finternal_char_font, Ffont_at):
* src/fringe.c (Ffringe_bitmaps_at_pos):
* src/search.c (search_command):
* src/textprop.c (get_char_property_and_overlay):
* src/window.c (Fpos_visible_in_window_p):
* src/xdisp.c (Fwindow_text_pixel_size):
Use it instead of CHECK_FIXNUM_COERCE_MARKER, so that
the code is simpler and treats bignums consistently with fixnums.
* src/buffer.h (CHECK_FIXNUM_COERCE_MARKER): Define here
rather than in lisp.h, and reimplement in terms of fix_position
so that it treats bignums consistently with fixnums.
* src/lisp.h (CHECK_FIXNUM_COERCE_MARKER): Move to buffer.h.
* src/textprop.c (validate_interval_range): Signal with original
bounds rather than modified ones.
Diffstat (limited to 'src/fns.c')
| -rw-r--r-- | src/fns.c | 18 |
1 files changed, 2 insertions, 16 deletions
| @@ -5187,22 +5187,8 @@ extract_data_from_object (Lisp_Object spec, | |||
| 5187 | struct buffer *bp = XBUFFER (object); | 5187 | struct buffer *bp = XBUFFER (object); |
| 5188 | set_buffer_internal (bp); | 5188 | set_buffer_internal (bp); |
| 5189 | 5189 | ||
| 5190 | if (NILP (start)) | 5190 | b = !NILP (start) ? fix_position (start) : BEGV; |
| 5191 | b = BEGV; | 5191 | e = !NILP (end) ? fix_position (end) : ZV; |
| 5192 | else | ||
| 5193 | { | ||
| 5194 | CHECK_FIXNUM_COERCE_MARKER (start); | ||
| 5195 | b = XFIXNUM (start); | ||
| 5196 | } | ||
| 5197 | |||
| 5198 | if (NILP (end)) | ||
| 5199 | e = ZV; | ||
| 5200 | else | ||
| 5201 | { | ||
| 5202 | CHECK_FIXNUM_COERCE_MARKER (end); | ||
| 5203 | e = XFIXNUM (end); | ||
| 5204 | } | ||
| 5205 | |||
| 5206 | if (b > e) | 5192 | if (b > e) |
| 5207 | { | 5193 | { |
| 5208 | EMACS_INT temp = b; | 5194 | EMACS_INT temp = b; |