aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.Client/PSVita/PSVitaExtras/user_malloc.c
diff options
context:
space:
mode:
Diffstat (limited to 'Minecraft.Client/PSVita/PSVitaExtras/user_malloc.c')
-rw-r--r--Minecraft.Client/PSVita/PSVitaExtras/user_malloc.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/Minecraft.Client/PSVita/PSVitaExtras/user_malloc.c b/Minecraft.Client/PSVita/PSVitaExtras/user_malloc.c
index 6b0e67b7..7036728f 100644
--- a/Minecraft.Client/PSVita/PSVitaExtras/user_malloc.c
+++ b/Minecraft.Client/PSVita/PSVitaExtras/user_malloc.c
@@ -52,14 +52,14 @@ typedef struct
int Malloc_BlocksAlloced; // this shows how many block node chunks have been allocated in Malloc_BlocksMemory
} SThreadStorage;
-__thread SThreadStorage *Malloc_ThreadStorage = nullptr;
+__thread SThreadStorage *Malloc_ThreadStorage = NULL;
/**E Replace _malloc_init function. */
/**J _malloc_init 関数と置き換わる */
void user_malloc_init(void)
{
int res;
- void *base = nullptr;
+ void *base = NULL;
/**E Allocate a memory block from the kernel */
/**J カーネルからメモリブロックを確保する */
@@ -80,7 +80,7 @@ void user_malloc_init(void)
/**E Generate mspace */
/**J mspace を生成する */
s_mspace = mspace_create(base, HEAP_SIZE);
- if (s_mspace == nullptr) {
+ if (s_mspace == NULL) {
/**E Error handling */
/**J エラー処理 */
sceLibcSetHeapInitError(HEAP_ERROR3);
@@ -95,7 +95,7 @@ void user_malloc_finalize(void)
{
int res;
- if (s_mspace != nullptr) {
+ if (s_mspace != NULL) {
/**E Free mspace */
/**J mspace を解放する */
res = mspace_destroy(s_mspace);
@@ -104,7 +104,7 @@ void user_malloc_finalize(void)
/**J エラー処理 */
__breakpoint(0);
}
- s_mspace = nullptr;
+ s_mspace = NULL;
}
if (SCE_OK <= s_heapUid) {
@@ -125,9 +125,9 @@ void user_malloc_finalize(void)
void user_registerthread()
{
Malloc_ThreadStorage = mspace_malloc(s_mspace, sizeof(SThreadStorage));
- Malloc_ThreadStorage->Malloc_Blocks = nullptr;
+ Malloc_ThreadStorage->Malloc_Blocks = NULL;
Malloc_ThreadStorage->Malloc_BlocksAlloced = 0;
- Malloc_ThreadStorage->Malloc_MemoryPool = nullptr;
+ Malloc_ThreadStorage->Malloc_MemoryPool = NULL;
}
// before a thread is destroyed make sure we free any space it might be holding on to
@@ -157,7 +157,7 @@ void user_removethread()
}
mspace_free(s_mspace, psStorage);
- Malloc_ThreadStorage = nullptr;
+ Malloc_ThreadStorage = NULL;
}
}
@@ -165,19 +165,19 @@ void user_removethread()
/**J malloc 関数と置き換わる */
void *user_malloc(size_t size)
{
- void *p = nullptr;
+ void *p = NULL;
SThreadStorage *psStorage = Malloc_ThreadStorage;
if( psStorage )
{
// is this the first time we've malloced
- if( psStorage->Malloc_MemoryPool == nullptr )
+ if( psStorage->Malloc_MemoryPool == NULL )
{
// create an array of pointers to Block nodes, one pointer for each memory bytes size up to 1036
psStorage->Malloc_MemoryPool = mspace_malloc(s_mspace, (MaxRetainedBytes+1) * 4);
for( int i = 0;i < (MaxRetainedBytes+1);i += 1 )
{
- psStorage->Malloc_MemoryPool[i] = nullptr;
+ psStorage->Malloc_MemoryPool[i] = NULL;
}
}
@@ -261,7 +261,7 @@ void user_free(void *ptr)
}
// we need a block node to retain the memory on our stack. do we have any block nodes available
- if( psStorage->Malloc_Blocks == nullptr )
+ if( psStorage->Malloc_Blocks == NULL )
{
if( psStorage->Malloc_BlocksAlloced == Malloc_BlocksMemorySize )
{
@@ -319,7 +319,7 @@ void *user_calloc(size_t nelem, size_t size)
/**J realloc 関数と置き換わる */
void *user_realloc(void *ptr, size_t size)
{
- void* p = nullptr;
+ void* p = NULL;
if( Malloc_ThreadStorage )
{