From ec8249513c0c5da126972e737ba3ba3dd600e413 Mon Sep 17 00:00:00 2001
From: "Sven M. Hallberg" <pesco@khjk.org>
Date: Wed, 7 Dec 2016 12:06:53 +0100
Subject: [PATCH] avoid more void pointer arithmetic

---
 src/sloballoc.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/sloballoc.c b/src/sloballoc.c
index 24537ff3..d16a879d 100644
--- a/src/sloballoc.c
+++ b/src/sloballoc.c
@@ -30,7 +30,7 @@ SLOB *slobinit(void *mem, size_t size)
 
     slob = mem;
     slob->size = size - sizeof(SLOB);
-    slob->head = mem + sizeof(SLOB);
+    slob->head = (struct block *)((uint8_t *)mem + sizeof(SLOB));
     slob->head->alloc.size = slob->size - sizeof(struct alloc);
     slob->head->next = NULL;
 
@@ -70,7 +70,7 @@ void *sloballoc(SLOB *slob, size_t size)
 
 void slobfree(SLOB *slob, void *a_)
 {
-    struct alloc *a = a_ - sizeof(struct alloc);
+    struct alloc *a = (struct alloc *)((uint8_t *)a_ - sizeof(struct alloc));
     struct block *b, **p, *left=NULL, *right=NULL, **rightp=NULL;
 
     // sanity check: a lies inside slob
@@ -203,7 +203,7 @@ HAllocator *h_sloballoc(void *mem, size_t size)
         return NULL;
 
     HAllocator *mm = mem;
-    SLOB *slob = slobinit(mem + sizeof(HAllocator), size - sizeof(HAllocator));
+    SLOB *slob = slobinit((uint8_t *)mem + sizeof(HAllocator), size - sizeof(HAllocator));
     if(!slob)
         return NULL;
     assert(slob == (SLOB *)(mm+1));
-- 
GitLab