(register Lisp_Object cell, Lisp_Object newcar)
{
CHECK_CONS (cell);
- CHECK_IMPURE (cell);
+ CHECK_IMPURE (cell, XCONS (cell));
XSETCAR (cell, newcar);
return newcar;
}
(register Lisp_Object cell, Lisp_Object newcdr)
{
CHECK_CONS (cell);
- CHECK_IMPURE (cell);
+ CHECK_IMPURE (cell, XCONS (cell));
XSETCDR (cell, newcdr);
return newcdr;
}
CHECK_NUMBER (idx);
idxval = XINT (idx);
CHECK_ARRAY (array, Qarrayp);
- CHECK_IMPURE (array);
+ CHECK_IMPURE (array, XVECTOR (array));
if (VECTORP (array))
{
{
INTERVAL new;
- CHECK_IMPURE (parent);
-
new = make_interval ();
- if (BUFFERP (parent))
+ if (! STRINGP (parent))
{
new->total_length = (BUF_Z (XBUFFER (parent))
- BUF_BEG (XBUFFER (parent)));
set_buffer_intervals (XBUFFER (parent), new);
new->position = BEG;
}
- else if (STRINGP (parent))
+ else
{
+ CHECK_IMPURE (parent, XSTRING (parent));
new->total_length = SCHARS (parent);
eassert (TOTAL_LENGTH (new) >= 0);
set_string_intervals (parent, new);
new->position = 0;
}
eassert (LENGTH (new) > 0);
-
+
set_interval_object (new, parent);
return new;
If we came to the end, add the parent in PREV. */
if (!CONSP (list) || KEYMAPP (list))
{
- CHECK_IMPURE (prev);
+ CHECK_IMPURE (prev, XCONS (prev));
XSETCDR (prev, parent);
return parent;
}
/* If we are preparing to dump, and DEF is a menu element
with a menu item indicator, copy it to ensure it is not pure. */
- if (CONSP (def) && PURE_P (def)
+ if (CONSP (def) && PURE_P (XCONS (def))
&& (EQ (XCAR (def), Qmenu_item) || STRINGP (XCAR (def))))
def = Fcons (XCAR (def), XCDR (def));
{
if (NATNUMP (idx) && XFASTINT (idx) < ASIZE (elt))
{
- CHECK_IMPURE (elt);
+ CHECK_IMPURE (elt, XVECTOR (elt));
ASET (elt, XFASTINT (idx), def);
return def;
}
}
else if (EQ (idx, XCAR (elt)))
{
- CHECK_IMPURE (elt);
+ CHECK_IMPURE (elt, XCONS (elt));
XSETCDR (elt, def);
return def;
}
}
else
elt = Fcons (idx, def);
- CHECK_IMPURE (insertion_point);
+ CHECK_IMPURE (insertion_point, XCONS (insertion_point));
XSETCDR (insertion_point, Fcons (elt, XCDR (insertion_point)));
}
}
#define PURESIZE (BASE_PURESIZE * PURESIZE_RATIO * PURESIZE_CHECKING_RATIO)
#endif
-/* Signal an error if OBJ is pure. */
-#define CHECK_IMPURE(obj) \
- { if (PURE_P (obj)) \
- pure_write_error (obj); }
-
extern _Noreturn void pure_write_error (Lisp_Object);
-\f
-/* Define PURE_P. */
extern EMACS_INT pure[];
-#define PURE_P(obj) \
- ((uintptr_t) XPNTR (obj) - (uintptr_t) pure <= PURESIZE)
+/* True if PTR is pure. */
+INLINE bool
+PURE_P (void *ptr)
+{
+ return (uintptr_t) (ptr) - (uintptr_t) pure <= PURESIZE;
+}
+
+/* Signal an error if OBJ is pure. PTR is OBJ untagged. */
+INLINE void
+CHECK_IMPURE (Lisp_Object obj, void *ptr)
+{
+ if (PURE_P (ptr))
+ pure_write_error (obj);
+}