mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-02-17 10:27:41 +00:00
Fix integer overflow in forward-point
* lisp/subr.el (forward-point): Rewrite in Lisp and move here ... * src/cmds.c (Fforward_point): ... from here. This fixes an integer overflow bug with (forward-point most-positive-fixnum).
This commit is contained in:
parent
d08c9472e8
commit
e4b6151ff1
2 changed files with 5 additions and 11 deletions
|
|
@ -1558,7 +1558,6 @@ be a list of the form returned by `event-start' and `event-end'."
|
|||
|
||||
;;;; Obsolescent names for functions.
|
||||
|
||||
(make-obsolete 'forward-point "use (+ (point) N) instead." "23.1")
|
||||
(make-obsolete 'buffer-has-markers-at nil "24.3")
|
||||
|
||||
(make-obsolete 'invocation-directory "use the variable of the same name."
|
||||
|
|
@ -1580,6 +1579,11 @@ be a list of the form returned by `event-start' and `event-end'."
|
|||
(make-obsolete 'string-as-multibyte "use `decode-coding-string'." "26.1")
|
||||
(make-obsolete 'string-make-multibyte "use `decode-coding-string'." "26.1")
|
||||
|
||||
(defun forward-point (n)
|
||||
"Return buffer position N characters after (before if N negative) point."
|
||||
(declare (obsolete "use (+ (point) N) instead." "23.1"))
|
||||
(+ (point) n))
|
||||
|
||||
(defun log10 (x)
|
||||
"Return (log X 10), the log base 10 of X."
|
||||
(declare (obsolete log "24.4"))
|
||||
|
|
|
|||
10
src/cmds.c
10
src/cmds.c
|
|
@ -31,15 +31,6 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
|
|||
|
||||
static int internal_self_insert (int, EMACS_INT);
|
||||
|
||||
DEFUN ("forward-point", Fforward_point, Sforward_point, 1, 1, 0,
|
||||
doc: /* Return buffer position N characters after (before if N negative) point. */)
|
||||
(Lisp_Object n)
|
||||
{
|
||||
CHECK_FIXNUM (n);
|
||||
|
||||
return make_fixnum (PT + XFIXNUM (n));
|
||||
}
|
||||
|
||||
/* Add N to point; or subtract N if FORWARD is false. N defaults to 1.
|
||||
Validate the new location. Return nil. */
|
||||
static Lisp_Object
|
||||
|
|
@ -526,7 +517,6 @@ syms_of_cmds (void)
|
|||
This is run after inserting the character. */);
|
||||
Vpost_self_insert_hook = Qnil;
|
||||
|
||||
defsubr (&Sforward_point);
|
||||
defsubr (&Sforward_char);
|
||||
defsubr (&Sbackward_char);
|
||||
defsubr (&Sforward_line);
|
||||
|
|
|
|||
Loading…
Reference in a new issue