}
/* If P is a pointer into a live buffer, return the buffer.
- Otherwise, return nil. M is a pointer to the mem_block for P. */
+ Otherwise, return nil. M is a pointer to the mem_block for P.
+ Also return killed buffers if ALL-BUFFERS is true. */
static Lisp_Object
-live_buffer_holding (struct mem_node *m, void *p)
+live_buffer_holding (struct mem_node *m, void *p, bool all_buffers)
{
- /* P must point into the block, and the buffer
- must not have been killed. */
+ /* P must point into the block, and the buffer must not
+ have been killed unless ALL-BUFFERS is true. */
if (m->type == MEM_TYPE_BUFFER)
{
struct buffer *b = m->start;
char *cb = m->start;
char *cp = p;
ptrdiff_t offset = cp - cb;
- if (0 <= offset && offset < sizeof *b && !NILP (b->name_))
+ if (0 <= offset && offset < sizeof *b
+ && (all_buffers || !NILP (b->name_)))
{
Lisp_Object obj;
XSETBUFFER (obj, b);
static bool
live_buffer_p (struct mem_node *m, void *p)
{
- return !NILP (live_buffer_holding (m, p));
+ return !NILP (live_buffer_holding (m, p, false));
}
/* 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)));
+ || EQ (obj, live_buffer_holding (m, po, true)));
break;
default:
break;
case MEM_TYPE_BUFFER:
- obj = live_buffer_holding (m, p);
+ obj = live_buffer_holding (m, p, true);
break;
case MEM_TYPE_CONS: