]> git.eshelyaron.com Git - emacs.git/commitdiff
(overlays_at): Handle extending vec uniformly.
authorRichard M. Stallman <rms@gnu.org>
Sat, 17 Aug 2002 04:53:57 +0000 (04:53 +0000)
committerRichard M. Stallman <rms@gnu.org>
Sat, 17 Aug 2002 04:53:57 +0000 (04:53 +0000)
(overlays_in): Handle extending vec from length 0 as in overlays_at.

src/buffer.c

index 7af8dbc334c4e5d321e8d8b7d417f950a763290c..d1ee97c192483cb99eceff23be2d901b6a8db9ff 100644 (file)
@@ -2498,9 +2498,11 @@ overlays_at (pos, extend, vec_ptr, len_ptr, next_ptr, prev_ptr, change_req)
            {
              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 @@ overlays_in (beg, end, extend, vec_ptr, len_ptr, next_ptr, prev_ptr)
                 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 @@ overlays_in (beg, end, extend, vec_ptr, len_ptr, next_ptr, prev_ptr)
            {
              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;
                }