]> code.delx.au - gnu-emacs/blobdiff - src/macros.c
; Merge branch 'fix/no-undo-boundary-on-secondary-buffer-change'
[gnu-emacs] / src / macros.c
index e5b8ab7087088d9ea6644430fbb65f619fcdeee6..7c6ab2efc306542311198c1dfbdb28d620429948 100644 (file)
@@ -22,9 +22,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include "lisp.h"
 #include "macros.h"
-#include "commands.h"
-#include "character.h"
-#include "buffer.h"
 #include "window.h"
 #include "keyboard.h"
 
@@ -187,16 +184,11 @@ store_kbd_macro_char (Lisp_Object c)
     {
       if (kb->kbd_macro_ptr - kb->kbd_macro_buffer == kb->kbd_macro_bufsize)
        {
-         ptrdiff_t ptr_offset, end_offset, nbytes;
-
-         ptr_offset = kb->kbd_macro_ptr - kb->kbd_macro_buffer;
-         end_offset = kb->kbd_macro_end - kb->kbd_macro_buffer;
-         if (min (PTRDIFF_MAX, SIZE_MAX) / sizeof *kb->kbd_macro_buffer / 2
-             < kb->kbd_macro_bufsize)
-           memory_full (SIZE_MAX);
-         nbytes = kb->kbd_macro_bufsize * (2 * sizeof *kb->kbd_macro_buffer);
-         kb->kbd_macro_buffer = xrealloc (kb->kbd_macro_buffer, nbytes);
-         kb->kbd_macro_bufsize *= 2;
+         ptrdiff_t ptr_offset = kb->kbd_macro_ptr - kb->kbd_macro_buffer;
+         ptrdiff_t end_offset = kb->kbd_macro_end - kb->kbd_macro_buffer;
+         kb->kbd_macro_buffer = xpalloc (kb->kbd_macro_buffer,
+                                         &kb->kbd_macro_bufsize,
+                                         1, -1, sizeof *kb->kbd_macro_buffer);
          kb->kbd_macro_ptr = kb->kbd_macro_buffer + ptr_offset;
          kb->kbd_macro_end = kb->kbd_macro_buffer + end_offset;
        }
@@ -294,7 +286,6 @@ each iteration of the macro.  Iteration stops if LOOPFUNC returns nil.  */)
   Lisp_Object tem;
   ptrdiff_t pdlcount = SPECPDL_INDEX ();
   EMACS_INT repeat = 1;
-  struct gcpro gcpro1, gcpro2;
   EMACS_INT success_count = 0;
 
   executing_kbd_macro_iterations = 0;
@@ -314,7 +305,6 @@ each iteration of the macro.  Iteration stops if LOOPFUNC returns nil.  */)
                      Vreal_this_command));
   record_unwind_protect (pop_kbd_macro, tem);
 
-  GCPRO2 (final, loopfunc);
   do
     {
       Vexecuting_kbd_macro = final;
@@ -344,7 +334,6 @@ each iteration of the macro.  Iteration stops if LOOPFUNC returns nil.  */)
 
   Vreal_this_command = Vexecuting_kbd_macro;
 
-  UNGCPRO;
   return unbind_to (pdlcount, Qnil);
 }
 \f
@@ -358,8 +347,6 @@ init_macros (void)
 void
 syms_of_macros (void)
 {
-  DEFSYM (Qexecute_kbd_macro, "execute-kbd-macro");
-
   DEFVAR_LISP ("kbd-macro-termination-hook", Vkbd_macro_termination_hook,
                doc: /* Normal hook run whenever a keyboard macro terminates.
 This is run whether the macro ends normally or prematurely due to an error.  */);