mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
Add 'recalloc' replacement
Added recalloc. _expand should be replaced as well in the nearby future. The functions should override the _xxxx_base variants instead, and be moved to a separate lib to cover the executable globally.
This commit is contained in:
parent
48d81d2369
commit
84e3414d7c
@ -86,6 +86,17 @@ extern "C" void* R_calloc(size_t nCount, size_t nSize)
|
||||
return pNew;
|
||||
}
|
||||
|
||||
extern "C" void* R_recalloc(void* pBlock, size_t nSize)
|
||||
{
|
||||
InitAllocator();
|
||||
|
||||
void* pMemOut = MemAllocSingleton()->Realloc(pBlock, nSize);
|
||||
|
||||
if (!pBlock)
|
||||
memset(pMemOut, NULL, nSize);
|
||||
|
||||
return pMemOut;
|
||||
}
|
||||
|
||||
extern "C" size_t R_mallocsize(void* pBlock)
|
||||
{
|
||||
|
@ -14,6 +14,7 @@ extern "C" size_t R_mallocsize(void* pBlock);
|
||||
#define realloc(pBlock, nSize) R_realloc(pBlock, nSize)
|
||||
#define strdup(pString) R_strdup(pString)
|
||||
#define calloc(nCount, nSize) R_calloc(nCount, nSize)
|
||||
#define recalloc(pBlock, nSize) R_recalloc(pBlock, nSize)
|
||||
#define mallocsize(pBlock) R_mallocsize(pBlock)
|
||||
|
||||
class IMemAlloc
|
||||
|
Loading…
x
Reference in New Issue
Block a user