|
@@ -100,3 +100,31 @@ void remove_block(void **block, void **starting_node) {
|
|
|
}
|
|
|
#endif /* BLOCKS_IN_DLL */
|
|
|
|
|
|
+void remove_block_from_lists(void **block, heap_t *heap) {
|
|
|
+#ifdef WITH_FIXED_LISTS
|
|
|
+ int fixed_list_id, i;
|
|
|
+#endif /* WITH_FIXED_LISTS */
|
|
|
+ size_t size;
|
|
|
+
|
|
|
+ size = get_size(*block);
|
|
|
+
|
|
|
+#ifdef WITH_FIXED_LISTS
|
|
|
+ /* Check if it is a block of a fixed list */
|
|
|
+ fixed_list_id = map_size_to_list(heap, size);
|
|
|
+ if(fixed_list_id != -1) {
|
|
|
+ /* If it is, find the fixed list and remove the block */
|
|
|
+ current_maptable_node = heap->maptable_head;
|
|
|
+ if(fixed_list_id != 0) {
|
|
|
+ for(i = 1; i < fixed_list_id; i++) {
|
|
|
+ current_maptable_node = current_maptable_node->next;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ remove_block(block, ¤t_maptable_node->fixed_list_head);
|
|
|
+ } else {
|
|
|
+#endif /* WITH_FIXED_LISTS */
|
|
|
+ remove_block(block, &heap->free_list_head);
|
|
|
+#ifdef WITH_FIXED_LISTS
|
|
|
+ }
|
|
|
+#endif /* WITH_FIXED_LISTS */
|
|
|
+}
|
|
|
+
|