[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/trunk r108894: Do not use Fdelete_overlay i
From: |
Dmitry Antipov |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/trunk r108894: Do not use Fdelete_overlay in delete_all_overlays |
Date: |
Fri, 06 Jul 2012 08:42:30 +0400 |
User-agent: |
Bazaar (2.5.0) |
------------------------------------------------------------
revno: 108894
committer: Dmitry Antipov <address@hidden>
branch nick: trunk
timestamp: Fri 2012-07-06 08:42:30 +0400
message:
Do not use Fdelete_overlay in delete_all_overlays
to avoid redundant calls to unchain_overlay.
* buffer.c (drop_overlay): New function.
(delete_all_overlays, Fdelete_overlay): Use it.
* minibuf.c (get_minibuffer): Fix comment.
modified:
src/ChangeLog
src/buffer.c
src/minibuf.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog 2012-07-06 03:08:57 +0000
+++ b/src/ChangeLog 2012-07-06 04:42:30 +0000
@@ -1,3 +1,11 @@
+2012-07-06 Dmitry Antipov <address@hidden>
+
+ Do not use Fdelete_overlay in delete_all_overlays
+ to avoid redundant calls to unchain_overlay.
+ * buffer.c (drop_overlay): New function.
+ (delete_all_overlays, Fdelete_overlay): Use it.
+ * minibuf.c (get_minibuffer): Fix comment.
+
2012-07-06 Paul Eggert <address@hidden>
Port to OpenBSD 5.1 amd64.
=== modified file 'src/buffer.c'
--- a/src/buffer.c 2012-07-05 18:35:48 +0000
+++ b/src/buffer.c 2012-07-06 04:42:30 +0000
@@ -667,27 +667,40 @@
return buf;
}
+/* Mark OV as no longer associated with B. */
+
+static void
+drop_overlay (struct buffer *b, struct Lisp_Overlay *ov)
+{
+ eassert (b == XBUFFER (Fmarker_buffer (ov->start)));
+ modify_overlay (b, marker_position (ov->start), marker_position (ov->end));
+ Fset_marker (ov->start, Qnil, Qnil);
+ Fset_marker (ov->end, Qnil, Qnil);
+
+}
+
+/* Delete all overlays of B and reset it's overlay lists. */
+
void
delete_all_overlays (struct buffer *b)
{
- Lisp_Object overlay;
-
- /* `reset_buffer' blindly sets the list of overlays to NULL, so we
- have to empty the list, otherwise we end up with overlays that
- think they belong to this buffer while the buffer doesn't know about
- them any more. */
- while (b->overlays_before)
- {
- XSETMISC (overlay, b->overlays_before);
- Fdelete_overlay (overlay);
- }
- while (b->overlays_after)
- {
- XSETMISC (overlay, b->overlays_after);
- Fdelete_overlay (overlay);
- }
- eassert (b->overlays_before == NULL);
- eassert (b->overlays_after == NULL);
+ struct Lisp_Overlay *ov, *next;
+
+ for (ov = b->overlays_before; ov; ov = next)
+ {
+ drop_overlay (b, ov);
+ next = ov->next;
+ ov->next = NULL;
+ }
+
+ for (ov = b->overlays_after; ov; ov = next)
+ {
+ drop_overlay (b, ov);
+ next = ov->next;
+ ov->next = NULL;
+ }
+
+ b->overlays_before = b->overlays_after = NULL;
}
/* Reinitialize everything about a buffer except its name and contents
@@ -3820,11 +3833,7 @@
= unchain_overlay (b->overlays_after, XOVERLAY (overlay));
eassert (XOVERLAY (overlay)->next == NULL);
- modify_overlay (b,
- marker_position (OVERLAY_START (overlay)),
- marker_position (OVERLAY_END (overlay)));
- Fset_marker (OVERLAY_START (overlay), Qnil, Qnil);
- Fset_marker (OVERLAY_END (overlay), Qnil, Qnil);
+ drop_overlay (b, XOVERLAY (overlay));
/* When deleting an overlay with before or after strings, turn off
display optimizations for the affected buffer, on the basis that
=== modified file 'src/minibuf.c'
--- a/src/minibuf.c 2012-07-05 06:32:41 +0000
+++ b/src/minibuf.c 2012-07-06 04:42:30 +0000
@@ -804,10 +804,9 @@
else
{
ptrdiff_t count = SPECPDL_INDEX ();
- /* `reset_buffer' blindly sets the list of overlays to NULL, so we
- have to empty the list, otherwise we end up with overlays that
- think they belong to this buffer while the buffer doesn't know about
- them any more. */
+ /* We have to empty both overlay lists. Otherwise we end
+ up with overlays that think they belong to this buffer
+ while the buffer doesn't know about them any more. */
delete_all_overlays (XBUFFER (buf));
reset_buffer (XBUFFER (buf));
record_unwind_protect (Fset_buffer, Fcurrent_buffer ());
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/trunk r108894: Do not use Fdelete_overlay in delete_all_overlays,
Dmitry Antipov <=