add new function FCEU_abort() for calling abort() with a message; use it when memory allocation fails instead of exit()
This commit is contained in:
parent
96e570ae44
commit
ff633d5acd
|
@ -42,10 +42,7 @@ static void *_FCEU_malloc(uint32 size)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(!ret)
|
if(!ret)
|
||||||
{
|
FCEU_abort("Error allocating memory!");
|
||||||
FCEU_PrintError("Error allocating memory! Doing a hard exit.");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -98,3 +95,9 @@ void FCEU_dfree(void *ptr)
|
||||||
{
|
{
|
||||||
return FCEU_free(ptr);
|
return FCEU_free(ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FCEU_abort(const char* message)
|
||||||
|
{
|
||||||
|
if(message) FCEU_PrintError(message);
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
|
|
@ -42,3 +42,6 @@ void *FCEU_dmalloc(uint32 size);
|
||||||
|
|
||||||
//don't use these. change them if you find them.
|
//don't use these. change them if you find them.
|
||||||
void FCEU_dfree(void *ptr);
|
void FCEU_dfree(void *ptr);
|
||||||
|
|
||||||
|
//aborts the process for fatal errors
|
||||||
|
void FCEU_abort(const char* message = nullptr);
|
||||||
|
|
Loading…
Reference in New Issue