VITA, PSP: use SDL_malloc

This commit is contained in:
Sylvain 2021-11-22 16:39:22 +01:00 committed by Sam Lantinga
parent 9fcc630fb3
commit 4d566e5d5d
2 changed files with 6 additions and 6 deletions

View File

@ -43,13 +43,13 @@ SDL_sem *SDL_CreateSemaphore(Uint32 initial_value)
{ {
SDL_sem *sem; SDL_sem *sem;
sem = (SDL_sem *) malloc(sizeof(*sem)); sem = (SDL_sem *) SDL_malloc(sizeof(*sem));
if (sem != NULL) { if (sem != NULL) {
/* TODO: Figure out the limit on the maximum value. */ /* TODO: Figure out the limit on the maximum value. */
sem->semid = sceKernelCreateSema("SDL sema", 0, initial_value, 255, NULL); sem->semid = sceKernelCreateSema("SDL sema", 0, initial_value, 255, NULL);
if (sem->semid < 0) { if (sem->semid < 0) {
SDL_SetError("Couldn't create semaphore"); SDL_SetError("Couldn't create semaphore");
free(sem); SDL_free(sem);
sem = NULL; sem = NULL;
} }
} else { } else {
@ -68,7 +68,7 @@ void SDL_DestroySemaphore(SDL_sem *sem)
sem->semid = 0; sem->semid = 0;
} }
free(sem); SDL_free(sem);
} }
} }

View File

@ -44,13 +44,13 @@ SDL_sem *SDL_CreateSemaphore(Uint32 initial_value)
{ {
SDL_sem *sem; SDL_sem *sem;
sem = (SDL_sem *) malloc(sizeof(*sem)); sem = (SDL_sem *) SDL_malloc(sizeof(*sem));
if (sem != NULL) { if (sem != NULL) {
/* TODO: Figure out the limit on the maximum value. */ /* TODO: Figure out the limit on the maximum value. */
sem->semid = sceKernelCreateSema("SDL sema", 0, initial_value, 255, NULL); sem->semid = sceKernelCreateSema("SDL sema", 0, initial_value, 255, NULL);
if (sem->semid < 0) { if (sem->semid < 0) {
SDL_SetError("Couldn't create semaphore"); SDL_SetError("Couldn't create semaphore");
free(sem); SDL_free(sem);
sem = NULL; sem = NULL;
} }
} else { } else {
@ -69,7 +69,7 @@ void SDL_DestroySemaphore(SDL_sem *sem)
sem->semid = 0; sem->semid = 0;
} }
free(sem); SDL_free(sem);
} }
} }