summaryrefslogtreecommitdiff
path: root/src/buffer.c
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1994-05-24 21:16:23 +0000
committerRichard M. Stallman <rms@gnu.org>1994-05-24 21:16:23 +0000
commit89a3e5e228b316dafc81a0dd823492e11533c5dd (patch)
tree678a6738032ddb2aef2554151b678f1d973e95c0 /src/buffer.c
parentd0fa874a4dff052bcb8c74c4efd26d31229c31e4 (diff)
downloademacs-89a3e5e228b316dafc81a0dd823492e11533c5dd.tar.gz
(verify_overlay_modification): GCPRO tail and overlay.
Avoid copying tail twice.
Diffstat (limited to 'src/buffer.c')
-rw-r--r--src/buffer.c34
1 files changed, 28 insertions, 6 deletions
diff --git a/src/buffer.c b/src/buffer.c
index 1293b1590e9..8ebfe98388c 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -2134,7 +2134,14 @@ verify_overlay_modification (start, end)
{
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 @@ verify_overlay_modification (start, end)
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 @@ verify_overlay_modification (start, end)
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 @@ verify_overlay_modification (start, end)
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 @@ verify_overlay_modification (start, end)
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 @@ verify_overlay_modification (start, end)
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 @@ verify_overlay_modification (start, end)
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