figured out how to make the block header smaller actually
This commit is contained in:
parent
302b6cdc85
commit
9ebc058188
1 changed files with 2 additions and 3 deletions
|
|
@ -15,7 +15,6 @@ struct msh_linux_block_t {
|
|||
msh_linux_block *prev;
|
||||
msh_linux_block *next;
|
||||
unsigned char free;
|
||||
char data[1];
|
||||
};
|
||||
#define MSH_BLOCK_SIZE 21
|
||||
|
||||
|
|
@ -50,7 +49,7 @@ static msh_linux_block *extend_heap(msh_linux_block *last, SIZE_TYPE size) {
|
|||
|
||||
static void split_block(msh_linux_block *b, SIZE_TYPE size) {
|
||||
msh_linux_block *new;
|
||||
new = (msh_linux_block *)b->data + size;
|
||||
new = ((msh_linux_block *)&b->free) + size + 1;
|
||||
new->size = b->size - size - MSH_BLOCK_SIZE;
|
||||
new->next = b->next;
|
||||
new->free = 1;
|
||||
|
|
@ -103,7 +102,7 @@ void *msh_allocate(SIZE_TYPE size) {
|
|||
}
|
||||
msh_linux_base = b;
|
||||
}
|
||||
return b->data;
|
||||
return (&b->free) + 1;
|
||||
};
|
||||
|
||||
void msh_deallocate(void *ptr) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue