From: Richard M. Stallman Date: Sat, 17 Aug 2002 04:53:57 +0000 (+0000) Subject: (overlays_at): Handle extending vec uniformly. X-Git-Tag: ttn-vms-21-2-B4~13662 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=4b0e44fc728df2f5d40b7e15a5b490b001503bbb;p=emacs.git (overlays_at): Handle extending vec uniformly. (overlays_in): Handle extending vec from length 0 as in overlays_at. --- diff --git a/src/buffer.c b/src/buffer.c index 7af8dbc334c..d1ee97c1924 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -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; }