From 22657b40985ec990ea20df878bde97af76b19ed1 Mon Sep 17 00:00:00 2001 From: Dmitry Antipov Date: Tue, 17 Jul 2012 08:29:50 +0400 Subject: [PATCH] Cleanup overlays checking. * buffer.h (OVERLAY_VALID): Remove as useless synonym of OVERLAYP. * buffer.c (overlay_touches_p, recenter_overlay_lists): Change to eassert and OVERLAYP. (sort_overlays): Change to use OVERLAYP. --- src/ChangeLog | 8 ++++++++ src/buffer.c | 46 +++++++--------------------------------------- src/buffer.h | 4 ---- 3 files changed, 15 insertions(+), 43 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 4a77507e557..d5d6b30a069 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,11 @@ +2012-07-17 Dmitry Antipov + + Cleanup overlays checking. + * buffer.h (OVERLAY_VALID): Remove as useless synonym of OVERLAYP. + * buffer.c (overlay_touches_p, recenter_overlay_lists): Change to + eassert and OVERLAYP. + (sort_overlays): Change to use OVERLAYP. + 2012-07-16 René Kyllingstad (tiny change) * editfns.c (Finsert_char): Make it interactive, and make the diff --git a/src/buffer.c b/src/buffer.c index b8c81a10d54..eaa3d94de34 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -2827,8 +2827,7 @@ overlay_touches_p (ptrdiff_t pos) ptrdiff_t endpos; XSETMISC (overlay ,tail); - if (!OVERLAYP (overlay)) - abort (); + eassert (OVERLAYP (overlay)); endpos = OVERLAY_POSITION (OVERLAY_END (overlay)); if (endpos < pos) @@ -2842,8 +2841,7 @@ overlay_touches_p (ptrdiff_t pos) ptrdiff_t startpos; XSETMISC (overlay, tail); - if (!OVERLAYP (overlay)) - abort (); + eassert (OVERLAYP (overlay)); startpos = OVERLAY_POSITION (OVERLAY_START (overlay)); if (pos < startpos) @@ -2898,7 +2896,7 @@ sort_overlays (Lisp_Object *overlay_vec, ptrdiff_t noverlays, struct window *w) Lisp_Object overlay; overlay = overlay_vec[i]; - if (OVERLAY_VALID (overlay) + if (OVERLAYP (overlay) && OVERLAY_POSITION (OVERLAY_START (overlay)) > 0 && OVERLAY_POSITION (OVERLAY_END (overlay)) > 0) { @@ -3169,22 +3167,7 @@ recenter_overlay_lists (struct buffer *buf, ptrdiff_t pos) { next = tail->next; XSETMISC (overlay, tail); - - /* If the overlay is not valid, get rid of it. */ - if (!OVERLAY_VALID (overlay)) -#if 1 - abort (); -#else - { - /* Splice the cons cell TAIL out of overlays_before. */ - if (!NILP (prev)) - XCDR (prev) = next; - else - buf->overlays_before = next; - tail = prev; - continue; - } -#endif + eassert (OVERLAYP (overlay)); beg = OVERLAY_START (overlay); end = OVERLAY_END (overlay); @@ -3209,7 +3192,7 @@ recenter_overlay_lists (struct buffer *buf, ptrdiff_t pos) Lisp_Object otherbeg, otheroverlay; XSETMISC (otheroverlay, other); - eassert (OVERLAY_VALID (otheroverlay)); + eassert (OVERLAYP (otheroverlay)); otherbeg = OVERLAY_START (otheroverlay); if (OVERLAY_POSITION (otherbeg) >= where) @@ -3237,22 +3220,7 @@ recenter_overlay_lists (struct buffer *buf, ptrdiff_t pos) { next = tail->next; XSETMISC (overlay, tail); - - /* If the overlay is not valid, get rid of it. */ - if (!OVERLAY_VALID (overlay)) -#if 1 - abort (); -#else - { - /* Splice the cons cell TAIL out of overlays_after. */ - if (!NILP (prev)) - XCDR (prev) = next; - else - buf->overlays_after = next; - tail = prev; - continue; - } -#endif + eassert (OVERLAYP (overlay)); beg = OVERLAY_START (overlay); end = OVERLAY_END (overlay); @@ -3282,7 +3250,7 @@ recenter_overlay_lists (struct buffer *buf, ptrdiff_t pos) Lisp_Object otherend, otheroverlay; XSETMISC (otheroverlay, other); - eassert (OVERLAY_VALID (otheroverlay)); + eassert (OVERLAYP (otheroverlay)); otherend = OVERLAY_END (otheroverlay); if (OVERLAY_POSITION (otherend) <= where) diff --git a/src/buffer.h b/src/buffer.h index 0615f85bfe6..4003be5c8c4 100644 --- a/src/buffer.h +++ b/src/buffer.h @@ -971,10 +971,6 @@ BUF_FETCH_MULTIBYTE_CHAR (struct buffer *buf, ptrdiff_t pos) /* Overlays */ -/* 1 if the OV is an overlay object. */ - -#define OVERLAY_VALID(OV) (OVERLAYP (OV)) - /* Return the marker that stands for where OV starts in the buffer. */ #define OVERLAY_START(OV) (XOVERLAY (OV)->start) -- 2.11.4.GIT