Cleanup overlays checking.
authorDmitry Antipov <dmantipov@yandex.ru>
Tue, 17 Jul 2012 04:29:50 +0000 (08:29 +0400)
committerDmitry Antipov <dmantipov@yandex.ru>
Tue, 17 Jul 2012 04:29:50 +0000 (08:29 +0400)
* 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
src/buffer.c
src/buffer.h

index 4a77507..d5d6b30 100644 (file)
@@ -1,3 +1,11 @@
+2012-07-17  Dmitry Antipov  <dmantipov@yandex.ru>
+
+       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  <Rene@Kyllingstad.com>  (tiny change)
 
        * editfns.c (Finsert_char): Make it interactive, and make the
index b8c81a1..eaa3d94 100644 (file)
@@ -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)
index 0615f85..4003be5 100644 (file)
@@ -971,10 +971,6 @@ BUF_FETCH_MULTIBYTE_CHAR (struct buffer *buf, ptrdiff_t pos)
 \f
 /* 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)