fix: return payload

This commit is contained in:
Renge 2022-03-25 21:13:36 -04:00
parent 748055996a
commit aff161557e
2 changed files with 23 additions and 5 deletions

View File

@ -3,11 +3,28 @@
int main(int argc, char const *argv[]) {
sf_set_magic(0x0);
sf_errno = 0;
size_t sz = sizeof(int);
int *x = sf_malloc(sz);
size_t sz_u = 200, sz_v = 150, sz_w = 50, sz_x = 150, sz_y = 200, sz_z = 250;
void *u = sf_malloc(sz_u);
sf_show_heap();
/* void *v = */ sf_malloc(sz_v);
sf_show_heap();
void *w = sf_malloc(sz_w);
sf_show_heap();
/* void *x = */ sf_malloc(sz_x);
sf_show_heap();
*x = 4;
void *y = sf_malloc(sz_y);
sf_show_heap();
/* void *z = */ sf_malloc(sz_z);
sf_show_heap();
sf_free(u);
sf_show_heap();
sf_free(w);
sf_show_heap();
sf_free(y);
return EXIT_SUCCESS;
}

View File

@ -92,6 +92,7 @@ void *sf_malloc(sf_size_t size)
// sf_show_block(block);
return block->body.payload;
}
ptr = ptr->body.links.next;
}
}
}
@ -121,7 +122,7 @@ void *sf_malloc(sf_size_t size)
// sf_show_block(ptr);
// sf_show_block(epi);
return ptr;
return ptr->body.payload;
}
void sf_free(void *pp)