[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master ff862f5 2/2: Reverse the meaning of 2nd arg to 'live_buffer_holdi
From: |
Eli Zaretskii |
Subject: |
master ff862f5 2/2: Reverse the meaning of 2nd arg to 'live_buffer_holding' |
Date: |
Sun, 15 Mar 2020 10:49:38 -0400 (EDT) |
branch: master
commit ff862f55f4a51c96254a198c17910f90e45b8986
Author: Eli Zaretskii <address@hidden>
Commit: Eli Zaretskii <address@hidden>
Reverse the meaning of 2nd arg to 'live_buffer_holding'
* src/alloc.c (live_buffer_holding): Rename ALL_BUFFERS ti
IGNORE_KILLED, and reverse the condition for returning killed
buffers.
(live_buffer_p): Add commentary.
(live_buffer_p, mark_maybe_object, mark_maybe_pointer): Reverse
the 2nd argument to live_buffer_holding. (Bug#39962)
---
src/alloc.c | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/src/alloc.c b/src/alloc.c
index 3d1090c..eed73bc 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -4596,12 +4596,12 @@ live_vector_p (struct mem_node *m, void *p)
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. */
@@ -4612,7 +4612,7 @@ live_buffer_holding (struct mem_node *m, void *p, bool
all_buffers)
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);
@@ -4622,10 +4622,12 @@ live_buffer_holding (struct mem_node *m, void *p, bool
all_buffers)
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. */
@@ -4683,7 +4685,7 @@ mark_maybe_object (Lisp_Object obj)
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:
@@ -4753,7 +4755,7 @@ mark_maybe_pointer (void *p)
break;
case MEM_TYPE_BUFFER:
- obj = live_buffer_holding (m, p, true);
+ obj = live_buffer_holding (m, p, false);
break;
case MEM_TYPE_CONS: