diff options
Diffstat (limited to 'src/marker.c')
-rw-r--r-- | src/marker.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/src/marker.c b/src/marker.c index 2d5b05cc2b8..0b2e1bf5c6b 100644 --- a/src/marker.c +++ b/src/marker.c @@ -1,5 +1,5 @@ /* Markers: examining, setting and deleting. - Copyright (C) 1985, 1997-1998, 2001-2018 Free Software Foundation, + Copyright (C) 1985, 1997-1998, 2001-2019 Free Software Foundation, Inc. This file is part of GNU Emacs. @@ -30,7 +30,7 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */ static ptrdiff_t cached_charpos; static ptrdiff_t cached_bytepos; static struct buffer *cached_buffer; -static EMACS_INT cached_modiff; +static modiff_count cached_modiff; /* Juanma Barranquero <lekktu@gmail.com> reported ~3x increased bootstrap time when byte_char_debug_check is enabled; so this @@ -332,6 +332,10 @@ buf_bytepos_to_charpos (struct buffer *b, ptrdiff_t bytepos) if (best_above == best_above_byte) return bytepos; + /* Check bytepos is not in the middle of a character. */ + eassert (bytepos >= BUF_Z_BYTE (b) + || CHAR_HEAD_P (BUF_FETCH_BYTE (b, bytepos))); + best_below = BEG; best_below_byte = BEG_BYTE; @@ -447,7 +451,7 @@ DEFUN ("marker-position", Fmarker_position, Smarker_position, 1, 1, 0, { CHECK_MARKER (marker); if (XMARKER (marker)->buffer) - return make_number (XMARKER (marker)->charpos); + return make_fixnum (XMARKER (marker)->charpos); return Qnil; } @@ -521,11 +525,11 @@ set_marker_internal (Lisp_Object marker, Lisp_Object position, { register ptrdiff_t charpos, bytepos; - /* Do not use CHECK_NUMBER_COERCE_MARKER because we + /* Do not use CHECK_FIXNUM_COERCE_MARKER because we don't want to call buf_charpos_to_bytepos if POSITION is a marker and so we know the bytepos already. */ - if (INTEGERP (position)) - charpos = XINT (position), bytepos = -1; + if (FIXNUMP (position)) + charpos = XFIXNUM (position), bytepos = -1; else if (MARKERP (position)) { charpos = XMARKER (position)->charpos; @@ -712,7 +716,7 @@ see `marker-insertion-type'. */) register Lisp_Object new; if (!NILP (marker)) - CHECK_TYPE (INTEGERP (marker) || MARKERP (marker), Qinteger_or_marker_p, marker); + CHECK_TYPE (FIXNUMP (marker) || MARKERP (marker), Qinteger_or_marker_p, marker); new = Fmake_marker (); Fset_marker (new, marker, @@ -752,7 +756,7 @@ DEFUN ("buffer-has-markers-at", Fbuffer_has_markers_at, Sbuffer_has_markers_at, register struct Lisp_Marker *tail; register ptrdiff_t charpos; - charpos = clip_to_bounds (BEG, XINT (position), Z); + charpos = clip_to_bounds (BEG, XFIXNUM (position), Z); for (tail = BUF_MARKERS (current_buffer); tail; tail = tail->next) if (tail->charpos == charpos) |