aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDmitry Antipov2012-07-17 08:29:50 +0400
committerDmitry Antipov2012-07-17 08:29:50 +0400
commit22657b40985ec990ea20df878bde97af76b19ed1 (patch)
treef8c3c15fe86a512d499446fe1f106c8fd5f594dd /src
parentddfc8813451b43f1cdb06fd07a47123b9f92bd70 (diff)
downloademacs-22657b40985ec990ea20df878bde97af76b19ed1.tar.gz
emacs-22657b40985ec990ea20df878bde97af76b19ed1.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog8
-rw-r--r--src/buffer.c46
-rw-r--r--src/buffer.h4
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 @@
12012-07-17 Dmitry Antipov <dmantipov@yandex.ru>
2
3 Cleanup overlays checking.
4 * buffer.h (OVERLAY_VALID): Remove as useless synonym of OVERLAYP.
5 * buffer.c (overlay_touches_p, recenter_overlay_lists): Change to
6 eassert and OVERLAYP.
7 (sort_overlays): Change to use OVERLAYP.
8
12012-07-16 René Kyllingstad <Rene@Kyllingstad.com> (tiny change) 92012-07-16 René Kyllingstad <Rene@Kyllingstad.com> (tiny change)
2 10
3 * editfns.c (Finsert_char): Make it interactive, and make the 11 * 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)
2827 ptrdiff_t endpos; 2827 ptrdiff_t endpos;
2828 2828
2829 XSETMISC (overlay ,tail); 2829 XSETMISC (overlay ,tail);
2830 if (!OVERLAYP (overlay)) 2830 eassert (OVERLAYP (overlay));
2831 abort ();
2832 2831
2833 endpos = OVERLAY_POSITION (OVERLAY_END (overlay)); 2832 endpos = OVERLAY_POSITION (OVERLAY_END (overlay));
2834 if (endpos < pos) 2833 if (endpos < pos)
@@ -2842,8 +2841,7 @@ overlay_touches_p (ptrdiff_t pos)
2842 ptrdiff_t startpos; 2841 ptrdiff_t startpos;
2843 2842
2844 XSETMISC (overlay, tail); 2843 XSETMISC (overlay, tail);
2845 if (!OVERLAYP (overlay)) 2844 eassert (OVERLAYP (overlay));
2846 abort ();
2847 2845
2848 startpos = OVERLAY_POSITION (OVERLAY_START (overlay)); 2846 startpos = OVERLAY_POSITION (OVERLAY_START (overlay));
2849 if (pos < startpos) 2847 if (pos < startpos)
@@ -2898,7 +2896,7 @@ sort_overlays (Lisp_Object *overlay_vec, ptrdiff_t noverlays, struct window *w)
2898 Lisp_Object overlay; 2896 Lisp_Object overlay;
2899 2897
2900 overlay = overlay_vec[i]; 2898 overlay = overlay_vec[i];
2901 if (OVERLAY_VALID (overlay) 2899 if (OVERLAYP (overlay)
2902 && OVERLAY_POSITION (OVERLAY_START (overlay)) > 0 2900 && OVERLAY_POSITION (OVERLAY_START (overlay)) > 0
2903 && OVERLAY_POSITION (OVERLAY_END (overlay)) > 0) 2901 && OVERLAY_POSITION (OVERLAY_END (overlay)) > 0)
2904 { 2902 {
@@ -3169,22 +3167,7 @@ recenter_overlay_lists (struct buffer *buf, ptrdiff_t pos)
3169 { 3167 {
3170 next = tail->next; 3168 next = tail->next;
3171 XSETMISC (overlay, tail); 3169 XSETMISC (overlay, tail);
3172 3170 eassert (OVERLAYP (overlay));
3173 /* If the overlay is not valid, get rid of it. */
3174 if (!OVERLAY_VALID (overlay))
3175#if 1
3176 abort ();
3177#else
3178 {
3179 /* Splice the cons cell TAIL out of overlays_before. */
3180 if (!NILP (prev))
3181 XCDR (prev) = next;
3182 else
3183 buf->overlays_before = next;
3184 tail = prev;
3185 continue;
3186 }
3187#endif
3188 3171
3189 beg = OVERLAY_START (overlay); 3172 beg = OVERLAY_START (overlay);
3190 end = OVERLAY_END (overlay); 3173 end = OVERLAY_END (overlay);
@@ -3209,7 +3192,7 @@ recenter_overlay_lists (struct buffer *buf, ptrdiff_t pos)
3209 Lisp_Object otherbeg, otheroverlay; 3192 Lisp_Object otherbeg, otheroverlay;
3210 3193
3211 XSETMISC (otheroverlay, other); 3194 XSETMISC (otheroverlay, other);
3212 eassert (OVERLAY_VALID (otheroverlay)); 3195 eassert (OVERLAYP (otheroverlay));
3213 3196
3214 otherbeg = OVERLAY_START (otheroverlay); 3197 otherbeg = OVERLAY_START (otheroverlay);
3215 if (OVERLAY_POSITION (otherbeg) >= where) 3198 if (OVERLAY_POSITION (otherbeg) >= where)
@@ -3237,22 +3220,7 @@ recenter_overlay_lists (struct buffer *buf, ptrdiff_t pos)
3237 { 3220 {
3238 next = tail->next; 3221 next = tail->next;
3239 XSETMISC (overlay, tail); 3222 XSETMISC (overlay, tail);
3240 3223 eassert (OVERLAYP (overlay));
3241 /* If the overlay is not valid, get rid of it. */
3242 if (!OVERLAY_VALID (overlay))
3243#if 1
3244 abort ();
3245#else
3246 {
3247 /* Splice the cons cell TAIL out of overlays_after. */
3248 if (!NILP (prev))
3249 XCDR (prev) = next;
3250 else
3251 buf->overlays_after = next;
3252 tail = prev;
3253 continue;
3254 }
3255#endif
3256 3224
3257 beg = OVERLAY_START (overlay); 3225 beg = OVERLAY_START (overlay);
3258 end = OVERLAY_END (overlay); 3226 end = OVERLAY_END (overlay);
@@ -3282,7 +3250,7 @@ recenter_overlay_lists (struct buffer *buf, ptrdiff_t pos)
3282 Lisp_Object otherend, otheroverlay; 3250 Lisp_Object otherend, otheroverlay;
3283 3251
3284 XSETMISC (otheroverlay, other); 3252 XSETMISC (otheroverlay, other);
3285 eassert (OVERLAY_VALID (otheroverlay)); 3253 eassert (OVERLAYP (otheroverlay));
3286 3254
3287 otherend = OVERLAY_END (otheroverlay); 3255 otherend = OVERLAY_END (otheroverlay);
3288 if (OVERLAY_POSITION (otherend) <= where) 3256 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)
971 971
972/* Overlays */ 972/* Overlays */
973 973
974/* 1 if the OV is an overlay object. */
975
976#define OVERLAY_VALID(OV) (OVERLAYP (OV))
977
978/* Return the marker that stands for where OV starts in the buffer. */ 974/* Return the marker that stands for where OV starts in the buffer. */
979 975
980#define OVERLAY_START(OV) (XOVERLAY (OV)->start) 976#define OVERLAY_START(OV) (XOVERLAY (OV)->start)