initMBlock(mblock); /* initialise the start fields */
bd = FIRST_BDESCR(mblock);
initGroup(n,bd); /* we know the group will fit */
initMBlock(mblock); /* initialise the start fields */
bd = FIRST_BDESCR(mblock);
initGroup(n,bd); /* we know the group will fit */
- initGroup(BLOCKS_PER_MBLOCK-n, bd+n);
- freeGroup(bd+n); /* add the rest on to the free list */
+ if (n < BLOCKS_PER_MBLOCK) {
+ initGroup(BLOCKS_PER_MBLOCK-n, bd+n);
+ freeGroup(bd+n); /* add the rest on to the free list */
+ }
- if (grp_start == NULL) { /* is it the first one we've found? */
+ /* is it the first one we've found or a non-contiguous megablock? */
+ if (grp_start == NULL ||
+ bd->start != last->start + MBLOCK_SIZE/sizeof(W_)) {