diff options
| author | Richard M. Stallman | 2002-08-17 04:53:57 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 2002-08-17 04:53:57 +0000 |
| commit | 4b0e44fc728df2f5d40b7e15a5b490b001503bbb (patch) | |
| tree | 1e5285cc5456e247b8c4649659a7d6c1ca393677 | |
| parent | 7838ea1bf36e0662369171b635d5bc13dbd222fe (diff) | |
| download | emacs-4b0e44fc728df2f5d40b7e15a5b490b001503bbb.tar.gz emacs-4b0e44fc728df2f5d40b7e15a5b490b001503bbb.zip | |
(overlays_at): Handle extending vec uniformly.
(overlays_in): Handle extending vec from length 0 as in overlays_at.
| -rw-r--r-- | src/buffer.c | 18 |
1 files changed, 14 insertions, 4 deletions
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) | |||
| 2498 | { | 2498 | { |
| 2499 | if (extend) | 2499 | if (extend) |
| 2500 | { | 2500 | { |
| 2501 | *len_ptr = len *= 2; | 2501 | /* Make it work with an initial len == 0. */ |
| 2502 | len *= 2; | ||
| 2502 | if (len == 0) | 2503 | if (len == 0) |
| 2503 | len = *len_ptr = 4; | 2504 | len = 4; |
| 2505 | *len_ptr = len; | ||
| 2504 | vec = (Lisp_Object *) xrealloc (vec, len * sizeof (Lisp_Object)); | 2506 | vec = (Lisp_Object *) xrealloc (vec, len * sizeof (Lisp_Object)); |
| 2505 | *vec_ptr = vec; | 2507 | *vec_ptr = vec; |
| 2506 | } | 2508 | } |
| @@ -2594,7 +2596,11 @@ overlays_in (beg, end, extend, vec_ptr, len_ptr, next_ptr, prev_ptr) | |||
| 2594 | Either make it bigger, or don't store any more in it. */ | 2596 | Either make it bigger, or don't store any more in it. */ |
| 2595 | if (extend) | 2597 | if (extend) |
| 2596 | { | 2598 | { |
| 2597 | *len_ptr = len *= 2; | 2599 | /* Make it work with an initial len == 0. */ |
| 2600 | len *= 2; | ||
| 2601 | if (len == 0) | ||
| 2602 | len = 4; | ||
| 2603 | *len_ptr = len; | ||
| 2598 | vec = (Lisp_Object *) xrealloc (vec, len * sizeof (Lisp_Object)); | 2604 | vec = (Lisp_Object *) xrealloc (vec, len * sizeof (Lisp_Object)); |
| 2599 | *vec_ptr = vec; | 2605 | *vec_ptr = vec; |
| 2600 | } | 2606 | } |
| @@ -2638,7 +2644,11 @@ overlays_in (beg, end, extend, vec_ptr, len_ptr, next_ptr, prev_ptr) | |||
| 2638 | { | 2644 | { |
| 2639 | if (extend) | 2645 | if (extend) |
| 2640 | { | 2646 | { |
| 2641 | *len_ptr = len *= 2; | 2647 | /* Make it work with an initial len == 0. */ |
| 2648 | len *= 2; | ||
| 2649 | if (len == 0) | ||
| 2650 | len = 4; | ||
| 2651 | *len_ptr = len; | ||
| 2642 | vec = (Lisp_Object *) xrealloc (vec, len * sizeof (Lisp_Object)); | 2652 | vec = (Lisp_Object *) xrealloc (vec, len * sizeof (Lisp_Object)); |
| 2643 | *vec_ptr = vec; | 2653 | *vec_ptr = vec; |
| 2644 | } | 2654 | } |