]> Git Repo - uclibc-ng.git/commitdiff
Use new malloc header macros.
authorMiles Bader <[email protected]>
Tue, 30 Jul 2002 09:22:51 +0000 (09:22 -0000)
committerMiles Bader <[email protected]>
Tue, 30 Jul 2002 09:22:51 +0000 (09:22 -0000)
libc/stdlib/malloc/free.c
libc/stdlib/malloc/malloc.c

index 6de5237dc6a6298822f4207497e4f6b4dfee7c42..65760412488af10911d7265e44f5cd20c6b05e9c 100644 (file)
@@ -28,8 +28,8 @@ free (void *mem)
       struct heap_free_area *fa;
       struct heap *heap = &__malloc_heap;
 
-      mem -= MALLOC_ALIGNMENT;
-      size = *(size_t *)mem;
+      size = MALLOC_SIZE (mem);
+      mem = MALLOC_BASE (mem);
 
       MALLOC_DEBUG ("free: 0x%lx (base = 0x%lx, total_size = %d)\n",
                    (long)mem + MALLOC_ALIGNMENT, (long)mem, size);
index bb1e07dfb7e1f246a7e3df1d9c758cd6696e9270..caf90ef02491ffda76e42ec37cffe8d7bead5eaf 100644 (file)
@@ -119,10 +119,11 @@ malloc (size_t size)
   __malloc_unlock ();
 
   if (mem)
-    /* Record the size of this block just before the returned address.  */
+    /* Record the size of this block.  */
     {
-      *(size_t *)mem = size;
-      mem += MALLOC_ALIGNMENT;
+      MALLOC_SET_SIZE (mem, size);
+
+      mem = MALLOC_ADDR (mem);
 
       MALLOC_DEBUG ("  malloc: returning 0x%lx (base:0x%lx, total_size:%d)\n",
                    (long)mem, (long)mem - MALLOC_ALIGNMENT, size);
This page took 0.026394 seconds and 4 git commands to generate.