emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] trunk r117532: * macros.c (Fstart_kbd_macro): Avoid need f


From: Paul Eggert
Subject: [Emacs-diffs] trunk r117532: * macros.c (Fstart_kbd_macro): Avoid need for overflow check.
Date: Mon, 14 Jul 2014 19:07:58 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 117532
revision-id: address@hidden
parent: address@hidden
committer: Paul Eggert <address@hidden>
branch nick: trunk
timestamp: Mon 2014-07-14 12:07:54 -0700
message:
  * macros.c (Fstart_kbd_macro): Avoid need for overflow check.
modified:
  src/ChangeLog                  changelog-20091113204419-o5vbwnq5f7feedwu-1438
  src/macros.c                   macros.c-20091113204419-o5vbwnq5f7feedwu-217
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2014-07-14 18:56:35 +0000
+++ b/src/ChangeLog     2014-07-14 19:07:54 +0000
@@ -1,6 +1,6 @@
 2014-07-14  Paul Eggert  <address@hidden>
 
-       * 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.
 

=== modified file 'src/macros.c'
--- a/src/macros.c      2014-07-14 18:56:35 +0000
+++ b/src/macros.c      2014-07-14 19:07:54 +0000
@@ -87,16 +87,13 @@
       /* 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.  */


reply via email to

[Prev in Thread] Current Thread [Next in Thread]