changeset 14301:621f53083d60

* macros.c (Fstart_kbd_macro): Use xmalloc. Shrink the kbd macro buffer if it is very big.
author Karl Heuer <kwzh@gnu.org>
date Wed, 24 Jan 1996 23:41:04 +0000
parents f777822a5d81
children 7af403b25839
files src/macros.c
diffstat 1 files changed, 10 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/macros.c	Wed Jan 24 23:40:40 1996 +0000
+++ b/src/macros.c	Wed Jan 24 23:41:04 1996 +0000
@@ -51,18 +51,24 @@
     {
       current_kboard->kbd_macro_bufsize = 30;
       current_kboard->kbd_macro_buffer
-	= (Lisp_Object *)malloc (30 * sizeof (Lisp_Object));
+	= (Lisp_Object *)xmalloc (30 * sizeof (Lisp_Object));
     }
   update_mode_lines++;
   if (NILP (append))
     {
+      if (current_kboard->kbd_macro_bufsize > 200)
+	{
+	  current_kboard->kbd_macro_bufsize = 30;
+	  current_kboard->kbd_macro_buffer
+	    = (Lisp_Object *)xrealloc (30 * sizeof (Lisp_Object));
+	}
       current_kboard->kbd_macro_ptr = current_kboard->kbd_macro_buffer;
       current_kboard->kbd_macro_end = current_kboard->kbd_macro_buffer;
-      message("Defining kbd macro...");
+      message ("Defining kbd macro...");
     }
   else
     {
-      message("Appending to kbd macro...");
+      message ("Appending to kbd macro...");
       current_kboard->kbd_macro_ptr = current_kboard->kbd_macro_end;
       Fexecute_kbd_macro (current_kboard->Vlast_kbd_macro,
 			  make_number (1));
@@ -101,7 +107,7 @@
 	= make_event_array ((current_kboard->kbd_macro_end
 			     - current_kboard->kbd_macro_buffer),
 			    current_kboard->kbd_macro_buffer);
-      message("Keyboard macro defined");
+      message ("Keyboard macro defined");
     }
 
   if (XFASTINT (repeat) == 0)