Commit f87273b9 authored by Lindsay Knupp's avatar Lindsay Knupp
Browse files

First-fit works

parent 0147c701
......@@ -53,9 +53,7 @@ void *allocate(size_t size, int alloc_type){
// Best-fit policy
if (alloc_type == 1){
curr_data = dlist_iter_begin(free_list);
diff = (curr_data->size) - size;
if (diff < 0){return -1;}
size_t diff = (curr_data->size) - size;
while(curr_data != NULL){
......@@ -73,6 +71,7 @@ int deallocate(void *ptr){
// dnode_print(removed_data);
dlist_add_back(free_list,removed_data->data,removed_data->size);
free(removed_data);
return 0;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment