MakeObjectTemplateFromFieldObjectTemplate
This commit is contained in:
@@ -40,7 +40,7 @@ void PutMemBlockHeader(void *block, struct MemBlock *prev, struct MemBlock *next
|
||||
|
||||
void PutFirstMemBlockHeader(void *block, u32 size)
|
||||
{
|
||||
PutMemBlockHeader(block, (struct MemBlock *)block, (struct MemBlock *)block, size - 16);
|
||||
PutMemBlockHeader(block, (struct MemBlock *)block, (struct MemBlock *)block, size - sizeof(struct MemBlock));
|
||||
}
|
||||
|
||||
void *AllocInternal(void *heapStart, u32 size)
|
||||
@@ -50,6 +50,7 @@ void *AllocInternal(void *heapStart, u32 size)
|
||||
struct MemBlock *splitBlock;
|
||||
u32 foundBlockSize;
|
||||
|
||||
// Alignment
|
||||
if (size & 3)
|
||||
size = 4 * ((size / 4) + 1);
|
||||
|
||||
@@ -60,7 +61,7 @@ void *AllocInternal(void *heapStart, u32 size)
|
||||
foundBlockSize = pos->size;
|
||||
|
||||
if (foundBlockSize >= size) {
|
||||
if (foundBlockSize - size <= 31) {
|
||||
if (foundBlockSize - size < 2 * sizeof(struct MemBlock)) {
|
||||
// The block isn't much bigger than the requested size,
|
||||
// so just use it.
|
||||
pos->flag = TRUE;
|
||||
|
||||
Reference in New Issue
Block a user