From 758e91f65f7ca4a39862ca23afcea08230f73efb Mon Sep 17 00:00:00 2001 From: CreeperMario Date: Tue, 10 Oct 2017 09:22:13 +1030 Subject: [PATCH] Revert "whb: Use MEM2 heap instead of DefaultHeap in logging functions" This reverts commit ef34f600c79bc9530af826bc0c2adc52773ef3ab, meaning that MEMAllocFromDefaultHeapEx is now used again, instead of MEMAllocFromExpHeapEx and MEMGetBaseHeapHandle. --- src/libwhb/src/log.c | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/src/libwhb/src/log.c b/src/libwhb/src/log.c index cf3d6d3..5794ef8 100644 --- a/src/libwhb/src/log.c +++ b/src/libwhb/src/log.c @@ -1,5 +1,4 @@ -#include -#include +#include #include #include #include @@ -58,8 +57,7 @@ WHBLogWrite(const char *str) BOOL WHBLogPrint(const char *str) { - MEMHeapHandle mem2_handle = MEMGetBaseHeapHandle(MEM_BASE_HEAP_MEM2); - char *buf = MEMAllocFromExpHeapEx(mem2_handle, PRINTF_BUFFER_LENGTH, 4); + char *buf = MEMAllocFromDefaultHeapEx(PRINTF_BUFFER_LENGTH, 4); if(!buf) { return FALSE; } @@ -73,15 +71,14 @@ WHBLogPrint(const char *str) } } - MEMFreeToExpHeap(mem2_handle, buf); + MEMFreeToDefaultHeap(buf); return TRUE; } BOOL WHBLogWritef(const char *fmt, ...) { - MEMHeapHandle mem2_handle = MEMGetBaseHeapHandle(MEM_BASE_HEAP_MEM2); - char *buf = MEMAllocFromExpHeapEx(mem2_handle, PRINTF_BUFFER_LENGTH, 4); + char *buf = MEMAllocFromDefaultHeapEx(PRINTF_BUFFER_LENGTH, 4); va_list va; if (!buf) { @@ -98,7 +95,7 @@ WHBLogWritef(const char *fmt, ...) } } - MEMFreeToExpHeap(mem2_handle, buf); + MEMFreeToDefaultHeap(buf); va_end(va); return TRUE; } @@ -106,9 +103,8 @@ WHBLogWritef(const char *fmt, ...) BOOL WHBLogPrintf(const char *fmt, ...) { - 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); + char *buf1 = MEMAllocFromDefaultHeapEx(PRINTF_BUFFER_LENGTH, 4); + char *buf2 = MEMAllocFromDefaultHeapEx(PRINTF_BUFFER_LENGTH, 4); va_list va; if (!buf1) { @@ -116,7 +112,7 @@ WHBLogPrintf(const char *fmt, ...) } if(!buf2) { - MEMFreeToExpHeap(mem2_handle, buf1); + MEMFreeToDefaultHeap(buf1); return FALSE; } @@ -132,8 +128,8 @@ WHBLogPrintf(const char *fmt, ...) } } - MEMFreeToExpHeap(mem2_handle, buf1); - MEMFreeToExpHeap(mem2_handle, buf2); + MEMFreeToDefaultHeap(buf1); + MEMFreeToDefaultHeap(buf2); va_end(va); return TRUE; }