#include <config.h>
-#include <setjmp.h>
+
#include "lisp.h"
#include "character.h"
#include "buffer.h"
bytepos - BUF_BEG_BYTE (b));
if (charpos - 1 != nchars)
- abort ();
+ emacs_abort ();
}
#else /* not MARKER_DEBUG */
-#define byte_char_debug_check(b,charpos,bytepos) do { } while (0)
+#define byte_char_debug_check(b, charpos, bytepos) do { } while (0)
#endif /* MARKER_DEBUG */
-
+
void
clear_charpos_cache (struct buffer *b)
{
ptrdiff_t best_below, best_below_byte;
if (charpos < BUF_BEG (b) || charpos > BUF_Z (b))
- abort ();
+ emacs_abort ();
best_above = BUF_Z (b);
best_above_byte = BUF_Z_BYTE (b);
ptrdiff_t best_below, best_below_byte;
if (bytepos < BUF_BEG_BYTE (b) || bytepos > BUF_Z_BYTE (b))
- abort ();
+ emacs_abort ();
best_above = BUF_Z (b);
best_above_byte = BUF_Z_BYTE (b);
does not preserve the buffer from being GC'd (it's weak), so
markers have to be unlinked from their buffer as soon as the buffer
is killed. */
- eassert (!NILP (BVAR (XBUFFER (buf), name)));
+ eassert (BUFFER_LIVE_P (XBUFFER (buf)));
return buf;
}
return Qnil;
return Qnil;
}
-/* Initialize just allocated Lisp_Marker. */
-
-void
-init_marker (struct Lisp_Marker *m, struct buffer *b,
- ptrdiff_t charpos, ptrdiff_t bytepos, int type)
-{
- m->buffer = b;
- m->charpos = charpos;
- m->bytepos = bytepos;
- m->insertion_type = type;
- if (b)
- {
- m->next = BUF_MARKERS (b);
- BUF_MARKERS (b) = m;
- }
- else
- m->next = NULL;
-}
-
/* Change M so it points to B at CHARPOS and BYTEPOS. */
-void
+static inline void
attach_marker (struct Lisp_Marker *m, struct buffer *b,
ptrdiff_t charpos, ptrdiff_t bytepos)
{
if (NILP (buffer))
{
b = current_buffer;
- eassert (!NILP (BVAR (b, name)));
+ eassert (BUFFER_LIVE_P (b));
}
else
{
CHECK_BUFFER (buffer);
b = XBUFFER (buffer);
- if (NILP (BVAR (b, name)))
+ if (!BUFFER_LIVE_P (b))
b = NULL;
}
return b;
else
{
register ptrdiff_t charpos, bytepos;
-
+
CHECK_NUMBER_COERCE_MARKER (position);
charpos = clip_to_bounds (restricted ? BUF_BEGV (b) : BUF_BEG (b),
XINT (position),
if (b)
{
- attach_marker
- (m, b,
+ attach_marker
+ (m, b,
clip_to_bounds (BUF_BEGV (b), charpos, BUF_ZV (b)),
clip_to_bounds (BUF_BEGV_BYTE (b), bytepos, BUF_ZV_BYTE (b)));
}
register struct Lisp_Marker *tail, **prev;
/* No dead buffers here. */
- eassert (!NILP (BVAR (b, name)));
+ eassert (BUFFER_LIVE_P (b));
marker->buffer = NULL;
prev = &BUF_MARKERS (b);
{
if (*prev == BUF_MARKERS (b))
{
- /* Deleting first marker from the buffer's chain. Crash
+ /* Deleting first marker from the buffer's chain. Crash
if new first marker in chain does not say it belongs
to the same buffer, or at least that they have the same
base buffer. */
if (tail->next && b->text != tail->next->buffer->text)
- abort ();
+ emacs_abort ();
}
*prev = tail->next;
/* We have removed the marker from the chain;