diff options
| author | Eli Zaretskii | 2020-03-15 16:47:54 +0200 |
|---|---|---|
| committer | Eli Zaretskii | 2020-03-15 16:47:54 +0200 |
| commit | ff862f55f4a51c96254a198c17910f90e45b8986 (patch) | |
| tree | 4ac6d53175b9622f8e9b845ef723a4ac61a624a9 /src/alloc.c | |
| parent | afaf2f465188ab1f438ff3e021260e7c529b1b9d (diff) | |
| download | emacs-ff862f55f4a51c96254a198c17910f90e45b8986.tar.gz emacs-ff862f55f4a51c96254a198c17910f90e45b8986.zip | |
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)
Diffstat (limited to 'src/alloc.c')
| -rw-r--r-- | src/alloc.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/alloc.c b/src/alloc.c index 3d1090c383d..eed73bcdc4e 100644 --- a/src/alloc.c +++ b/src/alloc.c | |||
| @@ -4596,12 +4596,12 @@ live_vector_p (struct mem_node *m, void *p) | |||
| 4596 | return !NILP (live_vector_holding (m, p)); | 4596 | return !NILP (live_vector_holding (m, p)); |
| 4597 | } | 4597 | } |
| 4598 | 4598 | ||
| 4599 | /* If P is a pointer into a live buffer, return the buffer. | 4599 | /* If P is a pointer into a valid buffer object, return the buffer. |
| 4600 | Otherwise, return nil. M is a pointer to the mem_block for P. | 4600 | Otherwise, return nil. M is a pointer to the mem_block for P. |
| 4601 | Also return killed buffers if ALL-BUFFERS is true. */ | 4601 | If IGNORE_KILLED is non-zero, treat killed buffers as invalid. */ |
| 4602 | 4602 | ||
| 4603 | static Lisp_Object | 4603 | static Lisp_Object |
| 4604 | live_buffer_holding (struct mem_node *m, void *p, bool all_buffers) | 4604 | live_buffer_holding (struct mem_node *m, void *p, bool ignore_killed) |
| 4605 | { | 4605 | { |
| 4606 | /* P must point into the block, and the buffer must not | 4606 | /* P must point into the block, and the buffer must not |
| 4607 | have been killed unless ALL-BUFFERS is true. */ | 4607 | have been killed unless ALL-BUFFERS is true. */ |
| @@ -4612,7 +4612,7 @@ live_buffer_holding (struct mem_node *m, void *p, bool all_buffers) | |||
| 4612 | char *cp = p; | 4612 | char *cp = p; |
| 4613 | ptrdiff_t offset = cp - cb; | 4613 | ptrdiff_t offset = cp - cb; |
| 4614 | if (0 <= offset && offset < sizeof *b | 4614 | if (0 <= offset && offset < sizeof *b |
| 4615 | && (all_buffers || !NILP (b->name_))) | 4615 | && !(ignore_killed && NILP (b->name_))) |
| 4616 | { | 4616 | { |
| 4617 | Lisp_Object obj; | 4617 | Lisp_Object obj; |
| 4618 | XSETBUFFER (obj, b); | 4618 | XSETBUFFER (obj, b); |
| @@ -4622,10 +4622,12 @@ live_buffer_holding (struct mem_node *m, void *p, bool all_buffers) | |||
| 4622 | return Qnil; | 4622 | return Qnil; |
| 4623 | } | 4623 | } |
| 4624 | 4624 | ||
| 4625 | /* If P is a pointer into a live (valid and not killed) buffer object, | ||
| 4626 | return non-zero. */ | ||
| 4625 | static bool | 4627 | static bool |
| 4626 | live_buffer_p (struct mem_node *m, void *p) | 4628 | live_buffer_p (struct mem_node *m, void *p) |
| 4627 | { | 4629 | { |
| 4628 | return !NILP (live_buffer_holding (m, p, false)); | 4630 | return !NILP (live_buffer_holding (m, p, true)); |
| 4629 | } | 4631 | } |
| 4630 | 4632 | ||
| 4631 | /* Mark OBJ if we can prove it's a Lisp_Object. */ | 4633 | /* Mark OBJ if we can prove it's a Lisp_Object. */ |
| @@ -4683,7 +4685,7 @@ mark_maybe_object (Lisp_Object obj) | |||
| 4683 | 4685 | ||
| 4684 | case Lisp_Vectorlike: | 4686 | case Lisp_Vectorlike: |
| 4685 | mark_p = (EQ (obj, live_vector_holding (m, po)) | 4687 | mark_p = (EQ (obj, live_vector_holding (m, po)) |
| 4686 | || EQ (obj, live_buffer_holding (m, po, true))); | 4688 | || EQ (obj, live_buffer_holding (m, po, false))); |
| 4687 | break; | 4689 | break; |
| 4688 | 4690 | ||
| 4689 | default: | 4691 | default: |
| @@ -4753,7 +4755,7 @@ mark_maybe_pointer (void *p) | |||
| 4753 | break; | 4755 | break; |
| 4754 | 4756 | ||
| 4755 | case MEM_TYPE_BUFFER: | 4757 | case MEM_TYPE_BUFFER: |
| 4756 | obj = live_buffer_holding (m, p, true); | 4758 | obj = live_buffer_holding (m, p, false); |
| 4757 | break; | 4759 | break; |
| 4758 | 4760 | ||
| 4759 | case MEM_TYPE_CONS: | 4761 | case MEM_TYPE_CONS: |