mirror of
https://github.com/CTCaer/hekate.git
synced 2024-11-26 19:52:11 +00:00
heap: Add heap object copy
This commit is contained in:
parent
9489eca487
commit
f5092bc981
4 changed files with 12 additions and 0 deletions
|
@ -128,6 +128,11 @@ void heap_init(u32 base)
|
||||||
_heap_create(&_heap, base);
|
_heap_create(&_heap, base);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void heap_copy(heap_t *heap)
|
||||||
|
{
|
||||||
|
memcpy(&_heap, heap, sizeof(heap_t));
|
||||||
|
}
|
||||||
|
|
||||||
void *malloc(u32 size)
|
void *malloc(u32 size)
|
||||||
{
|
{
|
||||||
return (void *)_heap_alloc(&_heap, size);
|
return (void *)_heap_alloc(&_heap, size);
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
#include "../../common/common_heap.h"
|
#include "../../common/common_heap.h"
|
||||||
|
|
||||||
void heap_init(u32 base);
|
void heap_init(u32 base);
|
||||||
|
void heap_copy(heap_t *heap);
|
||||||
void *malloc(u32 size);
|
void *malloc(u32 size);
|
||||||
void *calloc(u32 num, u32 size);
|
void *calloc(u32 num, u32 size);
|
||||||
void free(void *buf);
|
void free(void *buf);
|
||||||
|
|
|
@ -128,6 +128,11 @@ void heap_init(u32 base)
|
||||||
_heap_create(&_heap, base);
|
_heap_create(&_heap, base);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void heap_copy(heap_t *heap)
|
||||||
|
{
|
||||||
|
memcpy(&_heap, heap, sizeof(heap_t));
|
||||||
|
}
|
||||||
|
|
||||||
void *malloc(u32 size)
|
void *malloc(u32 size)
|
||||||
{
|
{
|
||||||
return (void *)_heap_alloc(&_heap, size);
|
return (void *)_heap_alloc(&_heap, size);
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
#include "../../../common/common_heap.h"
|
#include "../../../common/common_heap.h"
|
||||||
|
|
||||||
void heap_init(u32 base);
|
void heap_init(u32 base);
|
||||||
|
void heap_copy(heap_t *heap);
|
||||||
void *malloc(u32 size);
|
void *malloc(u32 size);
|
||||||
void *calloc(u32 num, u32 size);
|
void *calloc(u32 num, u32 size);
|
||||||
void free(void *buf);
|
void free(void *buf);
|
||||||
|
|
Loading…
Reference in a new issue