Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
there were no difference between __mmalloc_free and mfree anymore; merge them
authorMartin Quinson <martin.quinson@loria.fr>
Thu, 2 Feb 2012 20:14:25 +0000 (21:14 +0100)
committerMartin Quinson <martin.quinson@loria.fr>
Thu, 2 Feb 2012 20:14:25 +0000 (21:14 +0100)
src/xbt/mmalloc/mfree.c
src/xbt/mmalloc/mmalloc.c
src/xbt/mmalloc/mmprivate.h

index 41eefb1..bb7bd00 100644 (file)
@@ -15,7 +15,8 @@
 /* Return memory to the heap.
    Like `mfree' but don't call a mfree_hook if there is one.  */
 
-void __mmalloc_free(struct mdesc *mdp, void *ptr)
+/* Return memory to the heap.  */
+void mfree(struct mdesc *mdp, void *ptr)
 {
   int type;
   size_t block;
@@ -23,6 +24,9 @@ void __mmalloc_free(struct mdesc *mdp, void *ptr)
   struct list *prev, *next;
   int it;
 
+  if (ptr == NULL)
+         return;
+
   block = BLOCK(ptr);
 
   if ((char *) ptr < (char *) mdp->heapbase || block > mdp->heapsize) {
@@ -163,11 +167,3 @@ void __mmalloc_free(struct mdesc *mdp, void *ptr)
     break;
   }
 }
-
-/* Return memory to the heap.  */
-
-void mfree(xbt_mheap_t mdp, void *ptr)
-{
-  if (ptr != NULL)
-    __mmalloc_free(mdp, ptr);
-}
index 29451d1..3e9bdf2 100644 (file)
@@ -96,7 +96,7 @@ static void *register_morecore(struct mdesc *mdp, size_t size)
     newinfo[BLOCK(oldinfo)].type = 0;
     newinfo[BLOCK(oldinfo)].busy_block.size = BLOCKIFY(mdp->heapsize * sizeof(malloc_info));
     newinfo[BLOCK(oldinfo)].busy_block.busy_size = size;
-    __mmalloc_free(mdp, (void *) oldinfo);
+    mfree(mdp, (void *) oldinfo);
     mdp->heapsize = newsize;
   }
 
index b87c21d..8352e13 100644 (file)
@@ -183,7 +183,7 @@ struct mdesc {
        size_t heaplimit;
 
        /* Block information table.
-     Allocated with malign/__mmalloc_free (not mmalloc/mfree).  */
+     Allocated with malign/mfree (not mmalloc/mfree).  */
        /* Table indexed by block number giving per-block information.  */
        malloc_info *heapinfo;
 
@@ -225,10 +225,6 @@ void mmalloc_display_info(void *h);
 #define MMALLOC_ANONYMOUS (1 << 1)      /* Use anonymous mapping */
 #define MMALLOC_INITIALIZED    (1 << 2)        /* Initialized mmalloc */
 
-/* Internal version of `mfree' used in `morecore'. */
-
-extern void __mmalloc_free(struct mdesc *mdp, void *ptr);
-
 /* A default malloc descriptor for the single sbrk() managed region. */
 
 extern struct mdesc *__mmalloc_default_mdp;