[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 3973f68: Simplify and regularize some offset tests in alloc.c
From: |
Paul Eggert |
Subject: |
master 3973f68: Simplify and regularize some offset tests in alloc.c |
Date: |
Tue, 2 Jun 2020 01:42:07 -0400 (EDT) |
branch: master
commit 3973f68f590dabc6b7beda97d45fa8d88ae40ffc
Author: Paul Eggert <eggert@cs.ucla.edu>
Commit: Paul Eggert <eggert@cs.ucla.edu>
Simplify and regularize some offset tests in alloc.c
* src/alloc.c (live_string_holding, live_cons_holding)
(live_symbol_holding, live_float_p): Simplify and regularize.
---
src/alloc.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/src/alloc.c b/src/alloc.c
index 124b50d..573bac0 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -4456,7 +4456,7 @@ live_string_holding (struct mem_node *m, void *p)
/* P must point into a Lisp_String structure, and it
must not be on the free-list. */
- if (0 <= offset && offset < STRING_BLOCK_SIZE * sizeof b->strings[0])
+ if (0 <= offset && offset < sizeof b->strings)
{
cp = ptr_bounds_copy (cp, b);
struct Lisp_String *s = p = cp -= offset % sizeof b->strings[0];
@@ -4489,7 +4489,7 @@ live_cons_holding (struct mem_node *m, void *p)
/* P must point into a Lisp_Cons, not be
one of the unused cells in the current cons block,
and not be on the free-list. */
- if (0 <= offset && offset < CONS_BLOCK_SIZE * sizeof b->conses[0]
+ if (0 <= offset && offset < sizeof b->conses
&& (b != cons_block
|| offset / sizeof b->conses[0] < cons_block_index))
{
@@ -4525,7 +4525,7 @@ live_symbol_holding (struct mem_node *m, void *p)
/* P must point into the Lisp_Symbol, not be
one of the unused cells in the current symbol block,
and not be on the free-list. */
- if (0 <= offset && offset < SYMBOL_BLOCK_SIZE * sizeof b->symbols[0]
+ if (0 <= offset && offset < sizeof b->symbols
&& (b != symbol_block
|| offset / sizeof b->symbols[0] < symbol_block_index))
{
@@ -4559,9 +4559,8 @@ live_float_p (struct mem_node *m, void *p)
/* P must point to the start of a Lisp_Float and not be
one of the unused cells in the current float block. */
- return (offset >= 0
+ return (0 <= offset && offset < sizeof b->floats
&& offset % sizeof b->floats[0] == 0
- && offset < (FLOAT_BLOCK_SIZE * sizeof b->floats[0])
&& (b != float_block
|| offset / sizeof b->floats[0] < float_block_index));
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master 3973f68: Simplify and regularize some offset tests in alloc.c,
Paul Eggert <=