Mercurial > emacs
comparison src/buffer.c @ 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 | df9f70dd69a4 |
| children | 287494c5e770 |
comparison
equal
deleted
inserted
replaced
| 46919:69c58f2f2634 | 46920:a92cb918558c |
|---|---|
| 2496 { | 2496 { |
| 2497 if (idx == len) | 2497 if (idx == len) |
| 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 } |
| 2507 else | 2509 else |
| 2508 inhibit_storing = 1; | 2510 inhibit_storing = 1; |
| 2592 { | 2594 { |
| 2593 /* The supplied vector is full. | 2595 /* The supplied vector is full. |
| 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 } |
| 2601 else | 2607 else |
| 2602 inhibit_storing = 1; | 2608 inhibit_storing = 1; |
| 2636 { | 2642 { |
| 2637 if (idx == len) | 2643 if (idx == len) |
| 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 } |
| 2645 else | 2655 else |
| 2646 inhibit_storing = 1; | 2656 inhibit_storing = 1; |
