heap: Add heap object copy

This commit is contained in:
CTCaer 2020-06-14 14:02:13 +03:00
parent 9489eca487
commit f5092bc981
4 changed files with 12 additions and 0 deletions

View file

@ -128,6 +128,11 @@ void heap_init(u32 base)
_heap_create(&_heap, base);
}
void heap_copy(heap_t *heap)
{
memcpy(&_heap, heap, sizeof(heap_t));
}
void *malloc(u32 size)
{
return (void *)_heap_alloc(&_heap, size);

View file

@ -22,6 +22,7 @@
#include "../../common/common_heap.h"
void heap_init(u32 base);
void heap_copy(heap_t *heap);
void *malloc(u32 size);
void *calloc(u32 num, u32 size);
void free(void *buf);

View file

@ -128,6 +128,11 @@ void heap_init(u32 base)
_heap_create(&_heap, base);
}
void heap_copy(heap_t *heap)
{
memcpy(&_heap, heap, sizeof(heap_t));
}
void *malloc(u32 size)
{
return (void *)_heap_alloc(&_heap, size);

View file

@ -22,6 +22,7 @@
#include "../../../common/common_heap.h"
void heap_init(u32 base);
void heap_copy(heap_t *heap);
void *malloc(u32 size);
void *calloc(u32 num, u32 size);
void free(void *buf);