ucx/mempool.c

changeset 28
1666cbeb1db8
parent 17
2e7050c3a18e
child 48
621a4430c404
--- a/ucx/mempool.c	Sat Feb 18 18:36:30 2012 +0100
+++ b/ucx/mempool.c	Mon Feb 20 15:30:45 2012 +0100
@@ -75,20 +75,20 @@
 }
 
 void *ucx_mempool_realloc(UcxMempool *pool, void *ptr, size_t n) {
-    void *mem = ((char*)ptr) - sizeof(ucx_destructor);
+    char *mem = ((char*)ptr) - sizeof(ucx_destructor);
     char *newm = (char*) realloc(mem, n + sizeof(ucx_destructor));
     if (newm == NULL) return NULL;
     if (mem != newm) {
         for(int i=0;i<pool->ndata;i++) {
             if(pool->data[i] == mem) {
                 pool->data[i] = newm;
-                return ((char*) newm) + sizeof(ucx_destructor);
+                return newm + sizeof(ucx_destructor);
             }
         }
-        fprintf(stderr, "FATAL: %8x not in mpool %8x\n", mem, pool);
+        fprintf(stderr, "FATAL: %8x not in mpool %8x\n", ptr, pool);
         exit(1);
     } else {
-        return ((char*) newm) + sizeof(ucx_destructor);
+        return newm + sizeof(ucx_destructor);
     }
 }
 

mercurial