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;