diff --git a/src/libwhb/src/log.c b/src/libwhb/src/log.c index 5794ef8..cf3d6d3 100644 --- a/src/libwhb/src/log.c +++ b/src/libwhb/src/log.c @@ -1,4 +1,5 @@ -#include +#include +#include #include #include #include @@ -57,7 +58,8 @@ WHBLogWrite(const char *str) BOOL WHBLogPrint(const char *str) { - char *buf = MEMAllocFromDefaultHeapEx(PRINTF_BUFFER_LENGTH, 4); + MEMHeapHandle mem2_handle = MEMGetBaseHeapHandle(MEM_BASE_HEAP_MEM2); + char *buf = MEMAllocFromExpHeapEx(mem2_handle, PRINTF_BUFFER_LENGTH, 4); if(!buf) { return FALSE; } @@ -71,14 +73,15 @@ WHBLogPrint(const char *str) } } - MEMFreeToDefaultHeap(buf); + MEMFreeToExpHeap(mem2_handle, buf); return TRUE; } BOOL WHBLogWritef(const char *fmt, ...) { - char *buf = MEMAllocFromDefaultHeapEx(PRINTF_BUFFER_LENGTH, 4); + MEMHeapHandle mem2_handle = MEMGetBaseHeapHandle(MEM_BASE_HEAP_MEM2); + char *buf = MEMAllocFromExpHeapEx(mem2_handle, PRINTF_BUFFER_LENGTH, 4); va_list va; if (!buf) { @@ -95,7 +98,7 @@ WHBLogWritef(const char *fmt, ...) } } - MEMFreeToDefaultHeap(buf); + MEMFreeToExpHeap(mem2_handle, buf); va_end(va); return TRUE; } @@ -103,8 +106,9 @@ WHBLogWritef(const char *fmt, ...) BOOL WHBLogPrintf(const char *fmt, ...) { - char *buf1 = MEMAllocFromDefaultHeapEx(PRINTF_BUFFER_LENGTH, 4); - char *buf2 = MEMAllocFromDefaultHeapEx(PRINTF_BUFFER_LENGTH, 4); + MEMHeapHandle mem2_handle = MEMGetBaseHeapHandle(MEM_BASE_HEAP_MEM2); + char *buf1 = MEMAllocFromExpHeapEx(mem2_handle, PRINTF_BUFFER_LENGTH, 4); + char *buf2 = MEMAllocFromExpHeapEx(mem2_handle, PRINTF_BUFFER_LENGTH, 4); va_list va; if (!buf1) { @@ -112,7 +116,7 @@ WHBLogPrintf(const char *fmt, ...) } if(!buf2) { - MEMFreeToDefaultHeap(buf1); + MEMFreeToExpHeap(mem2_handle, buf1); return FALSE; } @@ -128,8 +132,8 @@ WHBLogPrintf(const char *fmt, ...) } } - MEMFreeToDefaultHeap(buf1); - MEMFreeToDefaultHeap(buf2); + MEMFreeToExpHeap(mem2_handle, buf1); + MEMFreeToExpHeap(mem2_handle, buf2); va_end(va); return TRUE; }