mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-27 10:10:57 +00:00
(VITA) Remove warnings
This commit is contained in:
parent
59d13c7131
commit
1a967c42d7
@ -1,6 +1,6 @@
|
||||
#include <errno.h>
|
||||
#include <reent.h>
|
||||
|
||||
#include "../../defines/psp_defines.h"
|
||||
static int _newlib_heap_memblock;
|
||||
static unsigned _newlib_heap_size;
|
||||
static char *_newlib_heap_base, *_newlib_heap_end, *_newlib_heap_cur;
|
||||
@ -11,19 +11,19 @@ static int _newlib_vm_memblock;
|
||||
extern int _newlib_vm_size_user __attribute__((weak));
|
||||
|
||||
void * _sbrk_r(struct _reent *reent, ptrdiff_t incr) {
|
||||
if (sceKernelLockLwMutex(_newlib_sbrk_mutex, 1, 0) < 0)
|
||||
if (sceKernelLockLwMutex((struct SceKernelLwMutexWork*)_newlib_sbrk_mutex, 1, 0) < 0)
|
||||
goto fail;
|
||||
if (!_newlib_heap_base || _newlib_heap_cur + incr >= _newlib_heap_end) {
|
||||
sceKernelUnlockLwMutex(_newlib_sbrk_mutex, 1);
|
||||
sceKernelUnlockLwMutex((struct SceKernelLwMutexWork*)_newlib_sbrk_mutex, 1);
|
||||
fail:
|
||||
reent->_errno = ENOMEM;
|
||||
return -1;
|
||||
return (void*)-1;
|
||||
}
|
||||
|
||||
char *prev_heap_end = _newlib_heap_cur;
|
||||
_newlib_heap_cur += incr;
|
||||
|
||||
sceKernelUnlockLwMutex(_newlib_sbrk_mutex, 1);
|
||||
sceKernelUnlockLwMutex((struct SceKernelLwMutexWork*)_newlib_sbrk_mutex, 1);
|
||||
return (void*) prev_heap_end;
|
||||
}
|
||||
|
||||
@ -35,7 +35,7 @@ void _init_vita_heap(void) {
|
||||
_newlib_vm_memblock = sceKernelAllocMemBlockForVM("code", _newlib_vm_size_user);
|
||||
|
||||
if (_newlib_vm_memblock < 0){
|
||||
sceClibPrintf("sceKernelAllocMemBlockForVM failed\n");
|
||||
//sceClibPrintf("sceKernelAllocMemBlockForVM failed\n");
|
||||
goto failure;
|
||||
}
|
||||
}else{
|
||||
@ -44,15 +44,11 @@ void _init_vita_heap(void) {
|
||||
|
||||
|
||||
// Create a mutex to use inside _sbrk_r
|
||||
if (sceKernelCreateLwMutex(_newlib_sbrk_mutex, "sbrk mutex", 0, 0, 0) < 0) {
|
||||
if (sceKernelCreateLwMutex((struct SceKernelLwMutexWork*)_newlib_sbrk_mutex, "sbrk mutex", 0, 0, 0) < 0) {
|
||||
goto failure;
|
||||
}
|
||||
if (&_newlib_heap_size_user != NULL) {
|
||||
_newlib_heap_size = _newlib_heap_size_user;
|
||||
} else {
|
||||
// Create a memblock for the heap memory, 32MB
|
||||
_newlib_heap_size = 32 * 1024 * 1024;
|
||||
}
|
||||
|
||||
_newlib_heap_size = _newlib_heap_size_user;
|
||||
|
||||
_newlib_heap_size -= _newlib_vm_size;
|
||||
|
||||
@ -60,7 +56,7 @@ void _init_vita_heap(void) {
|
||||
if (_newlib_heap_memblock < 0) {
|
||||
goto failure;
|
||||
}
|
||||
if (sceKernelGetMemBlockBase(_newlib_heap_memblock, &_newlib_heap_base) < 0) {
|
||||
if (sceKernelGetMemBlockBase(_newlib_heap_memblock, (void**)&_newlib_heap_base) < 0) {
|
||||
goto failure;
|
||||
}
|
||||
_newlib_heap_end = _newlib_heap_base + _newlib_heap_size;
|
||||
@ -81,7 +77,7 @@ int getVMBlock(){
|
||||
void _free_vita_heap(void) {
|
||||
|
||||
// Destroy the sbrk mutex
|
||||
sceKernelDeleteLwMutex(_newlib_sbrk_mutex);
|
||||
sceKernelDeleteLwMutex((struct SceKernelLwMutexWork*)_newlib_sbrk_mutex);
|
||||
|
||||
// Free the heap memblock to avoid memory leakage.
|
||||
sceKernelFreeMemBlock(_newlib_heap_memblock);
|
||||
|
Loading…
Reference in New Issue
Block a user