* macros.c (Fstart_kbd_macro): Avoid need for overflow check.

This commit is contained in:
Paul Eggert 2014-07-14 12:07:54 -07:00
parent 918be62752
commit 091adafaac
2 changed files with 3 additions and 6 deletions

View file

@ -1,6 +1,6 @@
2014-07-14 Paul Eggert <eggert@cs.ucla.edu>
* macros.c (Fstart_kbd_macro): Simplify.
* macros.c (Fstart_kbd_macro): Avoid need for overflow check.
This works around a GCC compiler bug when Emacs is configured with
--enable-gcc-warnings.

View file

@ -87,16 +87,13 @@ macro before appending to it. */)
/* Check the type of last-kbd-macro in case Lisp code changed it. */
len = CHECK_VECTOR_OR_STRING (KVAR (current_kboard, Vlast_kbd_macro));
if (INT_ADD_OVERFLOW (len, incr))
memory_full (SIZE_MAX);
/* Copy last-kbd-macro into the buffer, in case the Lisp code
has put another macro there. */
if (current_kboard->kbd_macro_bufsize < len + incr)
if (current_kboard->kbd_macro_bufsize - incr < len)
current_kboard->kbd_macro_buffer =
xpalloc (current_kboard->kbd_macro_buffer,
&current_kboard->kbd_macro_bufsize,
len + incr - current_kboard->kbd_macro_bufsize, -1,
len - current_kboard->kbd_macro_bufsize + incr, -1,
sizeof *current_kboard->kbd_macro_buffer);
/* Must convert meta modifier when copying string to vector. */