changeset 34361:385981407528

(store_kbd_macro_char): Change the way buffers are reallocated to be portable and less obfuscated.
author Gerd Moellmann <gerd@gnu.org>
date Fri, 08 Dec 2000 09:59:12 +0000
parents c6d74397e65f
children 020c1a0abaf6
files src/macros.c
diffstat 1 files changed, 11 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/src/macros.c	Fri Dec 08 09:58:48 2000 +0000
+++ b/src/macros.c	Fri Dec 08 09:59:12 2000 +0000
@@ -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 @@
 	   - 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;
     }
 }