Mercurial > emacs
changeset 7670:b3be53811505
(verify_overlay_modification): GCPRO tail and overlay.
Avoid copying tail twice.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Tue, 24 May 1994 21:16:23 +0000 |
parents | 93b5868150b9 |
children | 31d444fcae24 |
files | src/buffer.c |
diffstat | 1 files changed, 29 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/src/buffer.c Tue May 24 21:12:22 1994 +0000 +++ b/src/buffer.c Tue May 24 21:16:23 1994 +0000 @@ -2134,7 +2134,14 @@ { Lisp_Object prop, overlay, tail; int insertion = EQ (start, end); - + int tail_copied; + struct gcpro gcpro1, gcpro2; + + overlay = Qnil; + tail = Qnil; + GCPRO2 (overlay, tail); + + tail_copied = 0; for (tail = current_buffer->overlays_before; CONSP (tail); tail = XCONS (tail)->cdr) @@ -2156,7 +2163,9 @@ if (!NILP (prop)) { /* Copy TAIL in case the hook recenters the overlay lists. */ - tail = Fcopy_sequence (tail); + if (!tail_copied) + tail = Fcopy_sequence (tail); + tail_copied = 1; call_overlay_mod_hooks (prop, overlay, start, end); } } @@ -2165,7 +2174,9 @@ prop = Foverlay_get (overlay, Qinsert_behind_hooks); if (!NILP (prop)) { - tail = Fcopy_sequence (tail); + if (!tail_copied) + tail = Fcopy_sequence (tail); + tail_copied = 1; call_overlay_mod_hooks (prop, overlay, start, end); } } @@ -2176,12 +2187,15 @@ prop = Foverlay_get (overlay, Qmodification_hooks); if (!NILP (prop)) { - tail = Fcopy_sequence (tail); + if (!tail_copied) + tail = Fcopy_sequence (tail); + tail_copied = 1; call_overlay_mod_hooks (prop, overlay, start, end); } } } + tail_copied = 0; for (tail = current_buffer->overlays_after; CONSP (tail); tail = XCONS (tail)->cdr) @@ -2202,7 +2216,9 @@ prop = Foverlay_get (overlay, Qinsert_in_front_hooks); if (!NILP (prop)) { - tail = Fcopy_sequence (tail); + if (!tail_copied) + tail = Fcopy_sequence (tail); + tail_copied = 1; call_overlay_mod_hooks (prop, overlay, start, end); } } @@ -2211,7 +2227,9 @@ prop = Foverlay_get (overlay, Qinsert_behind_hooks); if (!NILP (prop)) { - tail = Fcopy_sequence (tail); + if (!tail_copied) + tail = Fcopy_sequence (tail); + tail_copied = 1; call_overlay_mod_hooks (prop, overlay, start, end); } } @@ -2222,11 +2240,15 @@ prop = Foverlay_get (overlay, Qmodification_hooks); if (!NILP (prop)) { - tail = Fcopy_sequence (tail); + if (!tail_copied) + tail = Fcopy_sequence (tail); + tail_copied = 1; call_overlay_mod_hooks (prop, overlay, start, end); } } } + + UNGCPRO; } static void