+
+ /* Copy old info into new location */
+ oldinfo = mdp->heapinfo;
+ newinfo = (malloc_info *) align(mdp, newsize * sizeof(malloc_info));
+ memcpy(newinfo, oldinfo, mdp->heapsize * sizeof(malloc_info));
+
+ /* Initialise the new blockinfo : */
+ memset((char*) newinfo + mdp->heapsize * sizeof(malloc_info), 0,
+ (newsize - mdp->heapsize)* sizeof(malloc_info));
+
+ /* Update the swag of busy blocks containing free fragments by applying the offset to all swag_hooks. Yeah. My hand is right in the fan and I still type */
+ size_t offset=((char*)newinfo)-((char*)oldinfo);
+
+ for (i=1/*first element of heapinfo describes the mdesc area*/;
+ i<mdp->heaplimit;
+ i++) {
+ update_hook(newinfo[i].freehook.next,offset);
+ update_hook(newinfo[i].freehook.prev,offset);
+ }
+ // also update the starting points of the swag
+ for (i=0;i<BLOCKLOG;i++) {
+ update_hook(mdp->fraghead[i].head,offset);
+ update_hook(mdp->fraghead[i].tail,offset);