Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Lindsay Knupp
csci315
Commits
f87273b9
Commit
f87273b9
authored
Nov 01, 2021
by
Lindsay Knupp
Browse files
First-fit works
parent
0147c701
Changes
1
Hide whitespace changes
Inline
Side-by-side
Labs/Lab7/src/allocator.c
View file @
f87273b9
...
...
@@ -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
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment