The find_fit function in this initial version is the same as the practic problem in chapter 10:
static void *find_fit(size_t asize)
{
void *bp;
/* first fit search */
for (bp = heap_listp; GET_SIZE(HDRP(bp)) > 0; bp = NEXT_BLKP(bp)) {
if (!GET_ALLOC(HDRP(bp)) && (asize <= GET_SIZE(HDRP(bp)))) {
return bp;
}
}
return NULL; /* no fit */
}