summaryrefslogtreecommitdiff
path: root/src/macros.c
diff options
context:
space:
mode:
authorGerd Moellmann <gerd@gnu.org>2000-12-08 09:59:12 +0000
committerGerd Moellmann <gerd@gnu.org>2000-12-08 09:59:12 +0000
commit23751e2577de307f57fc64734324db219f98c45d (patch)
tree2fa2e348ce6f0bd79b063c6be3331710e78d90de /src/macros.c
parentb5e55477b39213d5390d0f6a05afa85e9b05b7ea (diff)
downloademacs-23751e2577de307f57fc64734324db219f98c45d.tar.gz
(store_kbd_macro_char): Change the way buffers are
reallocated to be portable and less obfuscated.
Diffstat (limited to 'src/macros.c')
-rw-r--r--src/macros.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/macros.c b/src/macros.c
index 3c6e0b33edb..bf19526eb0e 100644
--- a/src/macros.c
+++ b/src/macros.c
@@ -1,5 +1,5 @@
/* Keyboard macros.
- Copyright (C) 1985, 1986, 1993 Free Software Foundation, Inc.
+ Copyright (C) 1985, 1986, 1993, 2000 Free Software Foundation, Inc.
This file is part of GNU Emacs.
@@ -183,17 +183,20 @@ store_kbd_macro_char (c)
- current_kboard->kbd_macro_buffer)
== current_kboard->kbd_macro_bufsize)
{
- register Lisp_Object *new;
+ int offset = (current_kboard->kbd_macro_ptr
+ - current_kboard->kbd_macro_buffer);
current_kboard->kbd_macro_bufsize *= 2;
- new = (Lisp_Object *)xrealloc (current_kboard->kbd_macro_buffer,
- (current_kboard->kbd_macro_bufsize
- * sizeof (Lisp_Object)));
+ current_kboard->kbd_macro_buffer
+ = (Lisp_Object *)xrealloc (current_kboard->kbd_macro_buffer,
+ (current_kboard->kbd_macro_bufsize
+ * sizeof (Lisp_Object)));
current_kboard->kbd_macro_ptr
- += new - current_kboard->kbd_macro_buffer;
+ = current_kboard->kbd_macro_buffer + offset;
current_kboard->kbd_macro_end
- += new - current_kboard->kbd_macro_buffer;
- current_kboard->kbd_macro_buffer = new;
+ = (current_kboard->kbd_macro_buffer
+ + current_kboard->kbd_macro_bufsize);
}
+
*current_kboard->kbd_macro_ptr++ = c;
}
}