From 7373a93f9b7532066b493caba2e67d538c8f8fe6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nils=20O=2E=20Sel=C3=A5sdal?= Date: Sat, 5 Jul 2025 20:03:00 +0200 Subject: [PATCH] Fix SAlloc warnings --- src/salloc.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/salloc.c b/src/salloc.c index ddec4cb..5f3a976 100644 --- a/src/salloc.c +++ b/src/salloc.c @@ -36,18 +36,13 @@ alloc_chunk(size_t sz) static Chunk * add_chunk(SAlloc *p, Chunk *c) { - Chunk *newchunk; - if (c == NULL) - return NULL; + return c; - if (p->current != NULL) - p->current->next = newchunk; + c->next = NULL; + c->firstfree = 0; - newchunk->next = NULL; - newchunk->firstfree = 0; - - return newchunk; + return c; } static Chunk * @@ -78,7 +73,7 @@ uc_new_salloc(size_t chunksz) if (first == NULL) { return NULL; } - p = &first->data.data[0]; + p = (SAlloc *)&first->data.data[0]; first->firstfree = sizeof *p; p->chunksz = chunksz; p->current = NULL;