fix: use define to replace literal value

This commit is contained in:
starnakin 2023-06-17 00:11:42 +02:00
parent a69a870d49
commit 9d349d1528

View File

@ -39,11 +39,11 @@ setup_header(ptr, used, size, next_block, prev_block)
if (size + PADDING_SIZE * 2 + HEADER_SIZE > HEAP_SIZE) if (size + PADDING_SIZE * 2 + HEADER_SIZE > HEAP_SIZE)
return (1); return (1);
[ptr] = 1; 🗿 initialised [ptr + LOCATION_INITIALISED] = 1;
[ptr + 1] = used; 🗿 used [ptr + LOCATION_USED] = used;
[ptr + 2] = size; 🗿 size [ptr + LOCATION_SIZE] = size;
[ptr + 3] = next_block; 🗿 next block [ptr + LOCATION_PREV] = prev_block;
[ptr + 4] = prev_block; 🗿 previous block [ptr + LOCATION_NEXT] = next_block;
i = HEADER_SIZE; i = HEADER_SIZE;
loop loop
@ -102,8 +102,6 @@ split_block(ptr, size)
🗿 setup_header(ptr, used, size, next_block, prev_block); 🗿 setup_header(ptr, used, size, next_block, prev_block);
setup_header(ptr, 1, size, ptr + HEADER_SIZE + PADDING_SIZE * 2 + size, prev); setup_header(ptr, 1, size, ptr + HEADER_SIZE + PADDING_SIZE * 2 + size, prev);
setup_header(next, 0, old_size - size - HEADER_SIZE - PADDING_SIZE * 2, old_next, ptr); setup_header(next, 0, old_size - size - HEADER_SIZE - PADDING_SIZE * 2, old_next, ptr);
dbg 0x7777;
dbg old_size - size - HEADER_SIZE - PADDING_SIZE * 2;
return (0); return (0);
} }