diff options
author | Karl Heuer <kwzh@gnu.org> | 1996-01-24 23:41:04 +0000 |
---|---|---|
committer | Karl Heuer <kwzh@gnu.org> | 1996-01-24 23:41:04 +0000 |
commit | 5a1f3e2839f6b4e361e381e7ee2aeebc829b11b2 (patch) | |
tree | 143637be35d337280b4301dd77890d2e3c4d1d45 /src/macros.c | |
parent | 0a9fcfa602f921602951434ef6e2990fe3599ec9 (diff) | |
download | emacs-5a1f3e2839f6b4e361e381e7ee2aeebc829b11b2.tar.gz |
* macros.c (Fstart_kbd_macro): Use xmalloc.
Shrink the kbd macro buffer if it is very big.
Diffstat (limited to 'src/macros.c')
-rw-r--r-- | src/macros.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/macros.c b/src/macros.c index 67c8ede6d4a..e63ea2be2e2 100644 --- a/src/macros.c +++ b/src/macros.c @@ -51,18 +51,24 @@ Non-nil arg (prefix arg) means append to last macro defined;\n\ { 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 @@ An argument of zero means repeat until error.") = 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) |