Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
kill an unused/undocumented/un-understood function
authorMartin Quinson <martin.quinson@loria.fr>
Thu, 2 Feb 2012 13:53:54 +0000 (14:53 +0100)
committerMartin Quinson <martin.quinson@loria.fr>
Thu, 2 Feb 2012 13:53:54 +0000 (14:53 +0100)
include/xbt/mmalloc.h
src/xbt/mmalloc/mmorecore.c

index 74643cd..f6ca905 100644 (file)
@@ -55,8 +55,6 @@ extern void *mmalloc_detach(xbt_mheap_t md);
 /* return the heap used when NULL is passed as first argument to any mm* function */
 extern xbt_mheap_t mmalloc_get_default_md(void);
 
-extern void *mmalloc_findbase(int size);
-
 extern void mmalloc_display_info_heap(xbt_mheap_t h);
 
 /* To change the heap used when using the legacy version malloc/free/realloc and such */
index 2c68d50..76ff04b 100644 (file)
@@ -144,41 +144,3 @@ void *__mmalloc_remap_core(struct mdesc *mdp)
   return ((void *) base);
 }
 
-void *mmalloc_findbase(int size)
-{
-  int fd;
-  int flags;
-  void *base = NULL;
-
-#ifdef MAP_ANONYMOUS
-  flags = MAP_PRIVATE | MAP_ANONYMOUS;
-  fd = -1;
-#else
-#ifdef MAP_FILE
-  flags = MAP_PRIVATE | MAP_FILE;
-#else
-  flags = MAP_PRIVATE;
-#endif
-  fd = open("/dev/zero", O_RDWR);
-  if (fd != -1) {
-    return ((void *) NULL);
-  }
-#endif
-  base = mmap(0, size, PROT_READ | PROT_WRITE, flags, fd, 0);
-  if (base != (void *) -1) {
-    munmap(base, (size_t) size);
-  }
-  if (fd != -1) {
-    close(fd);
-  }
-  if (base == 0) {
-    /* Don't allow mapping at address zero.  We use that value
-       to signal an error return, and besides, it is useful to
-       catch NULL pointers if it is unmapped.  Instead start
-       at the next page boundary. */
-    base = (void *) (long) getpagesize();
-  } else if (base == (void *) -1) {
-    base = NULL;
-  }
-  return ((void *) base);
-}