diff options
| author | Paul Eggert | 2025-12-07 15:21:46 -0800 |
|---|---|---|
| committer | Paul Eggert | 2025-12-07 15:45:19 -0800 |
| commit | caf0941e566642ec595ddf4c836f8c1ce605f32b (patch) | |
| tree | 95aa95c78760ff52517800b06275e070e3ba39a2 | |
| parent | a8b93649493f3b6c17e839e5547eb8924431b371 (diff) | |
| download | emacs-caf0941e566642ec595ddf4c836f8c1ce605f32b.tar.gz emacs-caf0941e566642ec595ddf4c836f8c1ce605f32b.zip | |
Pacify -Werror=null-dereference in ralloc.c
* src/ralloc.c (find_heap, update_heap_bloc_correspondence):
Omit unnecessary comparisons to NULL that cause GCC to warn.
| -rw-r--r-- | src/ralloc.c | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/src/ralloc.c b/src/ralloc.c index 3fa32ba9fea..8cf2c2b1b86 100644 --- a/src/ralloc.c +++ b/src/ralloc.c | |||
| @@ -175,13 +175,11 @@ find_heap (void *address) | |||
| 175 | { | 175 | { |
| 176 | heap_ptr heap; | 176 | heap_ptr heap; |
| 177 | 177 | ||
| 178 | for (heap = last_heap; heap; heap = heap->prev) | 178 | for (heap = last_heap; ; heap = heap->prev) |
| 179 | { | 179 | { |
| 180 | if (heap->start <= address && address <= heap->end) | 180 | if (heap->start <= address && address <= heap->end) |
| 181 | return heap; | 181 | return heap; |
| 182 | } | 182 | } |
| 183 | |||
| 184 | return NIL_HEAP; | ||
| 185 | } | 183 | } |
| 186 | 184 | ||
| 187 | /* Find SIZE bytes of space in a heap. | 185 | /* Find SIZE bytes of space in a heap. |
| @@ -509,10 +507,8 @@ update_heap_bloc_correspondence (bloc_ptr bloc, heap_ptr heap) | |||
| 509 | { | 507 | { |
| 510 | /* Advance through heaps, marking them empty, | 508 | /* Advance through heaps, marking them empty, |
| 511 | till we get to the one that B is in. */ | 509 | till we get to the one that B is in. */ |
| 512 | while (heap) | 510 | while (! (heap->bloc_start <= b->data && b->data <= heap->end)) |
| 513 | { | 511 | { |
| 514 | if (heap->bloc_start <= b->data && b->data <= heap->end) | ||
| 515 | break; | ||
| 516 | heap = heap->next; | 512 | heap = heap->next; |
| 517 | /* We know HEAP is not null now, | 513 | /* We know HEAP is not null now, |
| 518 | because there has to be space for bloc B. */ | 514 | because there has to be space for bloc B. */ |