]> code.delx.au - gnu-emacs/blobdiff - src/macros.c
doh, fixing year in ChangeLog entries introduced by last two commits
[gnu-emacs] / src / macros.c
index c73986abd34ee4613e3e38468f7468f5502bb509..e5b8ab7087088d9ea6644430fbb65f619fcdeee6 100644 (file)
@@ -1,6 +1,6 @@
 /* Keyboard macros.
 
-Copyright (C) 1985-1986, 1993, 2000-2014 Free Software Foundation, Inc.
+Copyright (C) 1985-1986, 1993, 2000-2015 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -28,9 +28,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include "window.h"
 #include "keyboard.h"
 
-static Lisp_Object Qexecute_kbd_macro;
-static Lisp_Object Qkbd_macro_termination_hook;
-
 /* Number of successful iterations so far
    for innermost keyboard macro.
    This is not bound at each level,
@@ -63,6 +60,8 @@ macro before appending to it.  */)
     {
       current_kboard->kbd_macro_buffer = xmalloc (30 * word_size);
       current_kboard->kbd_macro_bufsize = 30;
+      current_kboard->kbd_macro_ptr = current_kboard->kbd_macro_buffer;
+      current_kboard->kbd_macro_end = current_kboard->kbd_macro_buffer;
     }
   update_mode_lines = 19;
   if (NILP (append))
@@ -80,23 +79,20 @@ macro before appending to it.  */)
     }
   else
     {
-      const ptrdiff_t incr = 30;
+      int incr = 30;
       ptrdiff_t i, len;
       bool cvt;
 
       /* 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.  */
@@ -281,7 +277,7 @@ pop_kbd_macro (Lisp_Object info)
   tem = XCDR (info);
   executing_kbd_macro_index = XINT (XCAR (tem));
   Vreal_this_command = XCDR (tem);
-  Frun_hooks (1, &Qkbd_macro_termination_hook);
+  run_hook (Qkbd_macro_termination_hook);
 }
 
 DEFUN ("execute-kbd-macro", Fexecute_kbd_macro, Sexecute_kbd_macro, 1, 3, 0,