X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/f2d062a16daf5602b56944a78c51c36ae317a7fa..47a73b5d8591f5405691f45ee0c5884807ea7471:/src/xbt/mmalloc/sbrk-sup.c diff --git a/src/xbt/mmalloc/sbrk-sup.c b/src/xbt/mmalloc/sbrk-sup.c index 64e249fe15..522cbfcab2 100644 --- a/src/xbt/mmalloc/sbrk-sup.c +++ b/src/xbt/mmalloc/sbrk-sup.c @@ -8,16 +8,16 @@ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ -#include /* Prototypes for sbrk (maybe) */ +#include /* Prototypes for sbrk (maybe) */ -#include /* Prototypes for memcpy, memmove, memset, etc */ +#include /* Prototypes for memcpy, memmove, memset, etc */ #include "xbt.h" #include "mmprivate.h" -static void* sbrk_morecore (struct mdesc *mdp, int size); +static void *sbrk_morecore(struct mdesc *mdp, int size); #if NEED_DECLARATION_SBRK -extern void* sbrk (int size); +extern void *sbrk(int size); #endif /* The mmalloc() package can use a single implicit malloc descriptor @@ -30,38 +30,17 @@ struct mdesc *__mmalloc_default_mdp; /* Use sbrk() to get more core. */ -static void* -sbrk_morecore (mdp, size) - struct mdesc *mdp; - int size; +static void *sbrk_morecore(mdp, size) +struct mdesc *mdp; +int size; { - void* result; - - if ((result = sbrk (size)) == (void*) -1) - { - result = NULL; - } - else - { - mdp -> breakval = (char*)mdp -> breakval + size; - mdp -> top = (char*)mdp -> top + size; - } + void *result; + + if ((result = sbrk(size)) == (void *) -1) { + result = NULL; + } else { + mdp->breakval = (char *) mdp->breakval + size; + mdp->top = (char *) mdp->top + size; + } return (result); } - -#define HEAP_OFFSET 20480000 /* Safety gap from the heap's break address */ - -void *mmalloc_get_default_md(void) { - return __mmalloc_default_mdp; -} - -/* Initialize the default malloc descriptor. */ -#include "xbt_modinter.h" -void mmalloc_preinit(void) { - __mmalloc_default_mdp = mmalloc_attach(-1, (char *)sbrk(0) + HEAP_OFFSET); - xbt_assert(__mmalloc_default_mdp != NULL); -} -void mmalloc_postexit(void) { - /* Do not detach the default mdp or ldl won't be able to free the memory it allocated since we're in memory */ - // mmalloc_detach(__mmalloc_default_mdp); -}