changeset 46920:a92cb918558c

(overlays_at): Handle extending vec uniformly. (overlays_in): Handle extending vec from length 0 as in overlays_at.
author Richard M. Stallman <rms@gnu.org>
date Sat, 17 Aug 2002 04:53:57 +0000
parents 69c58f2f2634
children 40c8bb63c063
files src/buffer.c
diffstat 1 files changed, 14 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/buffer.c	Sat Aug 17 00:08:54 2002 +0000
+++ b/src/buffer.c	Sat Aug 17 04:53:57 2002 +0000
@@ -2498,9 +2498,11 @@
 	    {
 	      if (extend)
 		{
-		  *len_ptr = len *= 2;
+		  /* Make it work with an initial len == 0.  */
+		  len *= 2;
 		  if (len == 0)
-		    len = *len_ptr = 4;
+		    len = 4;
+		  *len_ptr = len;
 		  vec = (Lisp_Object *) xrealloc (vec, len * sizeof (Lisp_Object));
 		  *vec_ptr = vec;
 		}
@@ -2594,7 +2596,11 @@
 		 Either make it bigger, or don't store any more in it.  */
 	      if (extend)
 		{
-		  *len_ptr = len *= 2;
+		  /* Make it work with an initial len == 0.  */
+		  len *= 2;
+		  if (len == 0)
+		    len = 4;
+		  *len_ptr = len;
 		  vec = (Lisp_Object *) xrealloc (vec, len * sizeof (Lisp_Object));
 		  *vec_ptr = vec;
 		}
@@ -2638,7 +2644,11 @@
 	    {
 	      if (extend)
 		{
-		  *len_ptr = len *= 2;
+		  /* Make it work with an initial len == 0.  */
+		  len *= 2;
+		  if (len == 0)
+		    len = 4;
+		  *len_ptr = len;
 		  vec = (Lisp_Object *) xrealloc (vec, len * sizeof (Lisp_Object));
 		  *vec_ptr = vec;
 		}