hf_body.append(' entry->size = 0;')
hf_body.append(' entry->handle = NULL;')
hf_body.append('')
- hf_body.append(' //TODO go thru array and set numEntrys based on last valid entry g_memInfo.numEntrys--;')
hf_body.append(' if (entry == g_memInfo.pLastMapped)')
hf_body.append(' g_memInfo.pLastMapped = NULL;')
+ hf_body.append(' // adjust numEntrys to be last valid entry in list')
+ hf_body.append(' do {')
+ hf_body.append(' entry = g_memInfo.pEntrys + g_memInfo.numEntrys - 1;')
+ hf_body.append(' if (entry->valid == FALSE)')
+ hf_body.append(' g_memInfo.numEntrys--;')
+ hf_body.append(' } while ((entry->valid == FALSE) && (g_memInfo.numEntrys > 0));')
hf_body.append(' if (g_memInfo.numEntrys == 0)')
hf_body.append(' delete_mem_info();')
hf_body.append(' }')