mirror of
https://github.com/wiiu-env/wut.git
synced 2024-12-13 04:22:37 +01:00
whb: Use MEM2 heap instead of DefaultHeap in logging functions
This commit is contained in:
parent
51f3d4bdd7
commit
ef34f600c7
@ -1,4 +1,5 @@
|
||||
#include <defaultheap.h>
|
||||
#include <coreinit/baseheap.h>
|
||||
#include <coreinit/expandedheap.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user