return !NILP (live_vector_holding (m, p));
}
-/* If P is a pointer into a live buffer, return the buffer.
+/* If P is a pointer into a valid buffer object, return the buffer.
Otherwise, return nil. M is a pointer to the mem_block for P.
- Also return killed buffers if ALL-BUFFERS is true. */
+ If IGNORE_KILLED is non-zero, treat killed buffers as invalid. */
static Lisp_Object
-live_buffer_holding (struct mem_node *m, void *p, bool all_buffers)
+live_buffer_holding (struct mem_node *m, void *p, bool ignore_killed)
{
/* P must point into the block, and the buffer must not
have been killed unless ALL-BUFFERS is true. */
char *cp = p;
ptrdiff_t offset = cp - cb;
if (0 <= offset && offset < sizeof *b
- && (all_buffers || !NILP (b->name_)))
+ && !(ignore_killed && NILP (b->name_)))
{
Lisp_Object obj;
XSETBUFFER (obj, b);
return Qnil;
}
+/* If P is a pointer into a live (valid and not killed) buffer object,
+ return non-zero. */
static bool
live_buffer_p (struct mem_node *m, void *p)
{
- return !NILP (live_buffer_holding (m, p, false));
+ return !NILP (live_buffer_holding (m, p, true));
}
/* Mark OBJ if we can prove it's a Lisp_Object. */
case Lisp_Vectorlike:
mark_p = (EQ (obj, live_vector_holding (m, po))
- || EQ (obj, live_buffer_holding (m, po, true)));
+ || EQ (obj, live_buffer_holding (m, po, false)));
break;
default:
break;
case MEM_TYPE_BUFFER:
- obj = live_buffer_holding (m, p, true);
+ obj = live_buffer_holding (m, p, false);
break;
case MEM_TYPE_CONS: