add: free

This commit is contained in:
2023-06-18 11:11:23 +02:00
parent cea014d97b
commit 60ca301082
3 changed files with 41 additions and 18 deletions

View File

@ -1,10 +1,13 @@
main()
{
local ptr1;
local ptr2;
name = "galloc";
dbg galloc(1);
dbg galloc(1);
dbg galloc(1);
dbg galloc(1);
dbg galloc(1);
ptr1 = galloc(1);
test_str(ptr1, heap + LOCATION_DATA, "");
free(ptr1);
ptr1 = galloc(1);
test_str(ptr1, heap + LOCATION_DATA, "alloc after free");
ptr2 = galloc(1);
}

View File

@ -1,17 +1,6 @@
global name;
putstr(str){
local i;
i = 0;
loop {
if ([str + i] == 0)
return;
wrt [str + i];
i++;
}
}
test(value, reach_value, description)
test_str(value, reach_value, description)
{
putstr(name);
if (value != reach_value)