diff options
| author | Paul Eggert | 2020-06-01 22:41:33 -0700 |
|---|---|---|
| committer | Paul Eggert | 2020-06-01 22:42:01 -0700 |
| commit | 3973f68f590dabc6b7beda97d45fa8d88ae40ffc (patch) | |
| tree | a1e78b5c3f97be50635da518913788ec7938670d /src | |
| parent | e10940f3f14e91e2740b139c1ff2983a88d66cc7 (diff) | |
| download | emacs-3973f68f590dabc6b7beda97d45fa8d88ae40ffc.tar.gz emacs-3973f68f590dabc6b7beda97d45fa8d88ae40ffc.zip | |
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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/alloc.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/alloc.c b/src/alloc.c index 124b50d0d3f..573bac00c84 100644 --- a/src/alloc.c +++ b/src/alloc.c | |||
| @@ -4456,7 +4456,7 @@ live_string_holding (struct mem_node *m, void *p) | |||
| 4456 | 4456 | ||
| 4457 | /* P must point into a Lisp_String structure, and it | 4457 | /* P must point into a Lisp_String structure, and it |
| 4458 | must not be on the free-list. */ | 4458 | must not be on the free-list. */ |
| 4459 | if (0 <= offset && offset < STRING_BLOCK_SIZE * sizeof b->strings[0]) | 4459 | if (0 <= offset && offset < sizeof b->strings) |
| 4460 | { | 4460 | { |
| 4461 | cp = ptr_bounds_copy (cp, b); | 4461 | cp = ptr_bounds_copy (cp, b); |
| 4462 | struct Lisp_String *s = p = cp -= offset % sizeof b->strings[0]; | 4462 | struct Lisp_String *s = p = cp -= offset % sizeof b->strings[0]; |
| @@ -4489,7 +4489,7 @@ live_cons_holding (struct mem_node *m, void *p) | |||
| 4489 | /* P must point into a Lisp_Cons, not be | 4489 | /* P must point into a Lisp_Cons, not be |
| 4490 | one of the unused cells in the current cons block, | 4490 | one of the unused cells in the current cons block, |
| 4491 | and not be on the free-list. */ | 4491 | and not be on the free-list. */ |
| 4492 | if (0 <= offset && offset < CONS_BLOCK_SIZE * sizeof b->conses[0] | 4492 | if (0 <= offset && offset < sizeof b->conses |
| 4493 | && (b != cons_block | 4493 | && (b != cons_block |
| 4494 | || offset / sizeof b->conses[0] < cons_block_index)) | 4494 | || offset / sizeof b->conses[0] < cons_block_index)) |
| 4495 | { | 4495 | { |
| @@ -4525,7 +4525,7 @@ live_symbol_holding (struct mem_node *m, void *p) | |||
| 4525 | /* P must point into the Lisp_Symbol, not be | 4525 | /* P must point into the Lisp_Symbol, not be |
| 4526 | one of the unused cells in the current symbol block, | 4526 | one of the unused cells in the current symbol block, |
| 4527 | and not be on the free-list. */ | 4527 | and not be on the free-list. */ |
| 4528 | if (0 <= offset && offset < SYMBOL_BLOCK_SIZE * sizeof b->symbols[0] | 4528 | if (0 <= offset && offset < sizeof b->symbols |
| 4529 | && (b != symbol_block | 4529 | && (b != symbol_block |
| 4530 | || offset / sizeof b->symbols[0] < symbol_block_index)) | 4530 | || offset / sizeof b->symbols[0] < symbol_block_index)) |
| 4531 | { | 4531 | { |
| @@ -4559,9 +4559,8 @@ live_float_p (struct mem_node *m, void *p) | |||
| 4559 | 4559 | ||
| 4560 | /* P must point to the start of a Lisp_Float and not be | 4560 | /* P must point to the start of a Lisp_Float and not be |
| 4561 | one of the unused cells in the current float block. */ | 4561 | one of the unused cells in the current float block. */ |
| 4562 | return (offset >= 0 | 4562 | return (0 <= offset && offset < sizeof b->floats |
| 4563 | && offset % sizeof b->floats[0] == 0 | 4563 | && offset % sizeof b->floats[0] == 0 |
| 4564 | && offset < (FLOAT_BLOCK_SIZE * sizeof b->floats[0]) | ||
| 4565 | && (b != float_block | 4564 | && (b != float_block |
| 4566 | || offset / sizeof b->floats[0] < float_block_index)); | 4565 | || offset / sizeof b->floats[0] < float_block_index)); |
| 4567 | } | 4566 | } |