/* Change the size of a block allocated by `mmalloc'. */
-/* Copyright (c) 2010-2014. The SimGrid Team.
+/* Copyright (c) 2010-2018. The SimGrid Team.
* All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
{
void *result;
size_t blocks;
- size_t oldlimit;
/* Only keep real realloc, and reroute hidden malloc and free to the relevant functions */
if (size == 0) {
if ((char *) ptr < (char *) mdp->heapbase || BLOCK(ptr) > mdp->heapsize) {
printf("FIXME. Ouch, this pointer is not mine, refusing to proceed (another solution would be to malloc "
"it instead of reallocing it, see source code)\n");
- result = mmalloc(mdp, size);
abort();
- return result;
}
size_t requested_size = size; // The amount of memory requested by user, for real
mdp->heapinfo[it].busy_block.busy_size = 0;
}
- mdp->heapinfo[block + blocks].busy_block.size
- = mdp->heapinfo[block].busy_block.size - blocks;
+ mdp->heapinfo[block + blocks].busy_block.size = mdp->heapinfo[block].busy_block.size - blocks;
mfree(mdp, ADDRESS(block + blocks));
mdp->heapinfo[block].busy_block.size = blocks;
action for obvious reasons. */
blocks = mdp->heapinfo[block].busy_block.size;
/* Prevent free from actually returning memory to the system. */
- oldlimit = mdp->heaplimit;
+ size_t oldlimit = mdp->heaplimit;
mdp->heaplimit = 0;
mfree(mdp, ptr);
mdp->heaplimit = oldlimit;