use SDL_InvalidParamError or SDL_assert instead of custom SDL_SetError

This commit is contained in:
pionere
2022-01-17 16:26:02 +01:00
committed by Ryan C. Gordon
parent 4a17612bff
commit ebdd536676
36 changed files with 109 additions and 123 deletions

View File

@@ -65,16 +65,14 @@ int
SDL_mutexP(SDL_mutex * mutex)
{
if (mutex == NULL) {
SDL_SetError("Passed a NULL mutex");
return -1;
return SDL_InvalidParamError("mutex");
}
try {
mutex->cpp_mutex.lock();
return 0;
} catch (std::system_error & ex) {
SDL_SetError("unable to lock a C++ mutex: code=%d; %s", ex.code(), ex.what());
return -1;
return SDL_SetError("unable to lock a C++ mutex: code=%d; %s", ex.code(), ex.what());
}
}
@@ -84,7 +82,7 @@ SDL_TryLockMutex(SDL_mutex * mutex)
{
int retval = 0;
if (mutex == NULL) {
return SDL_SetError("Passed a NULL mutex");
return SDL_InvalidParamError("mutex");
}
if (mutex->cpp_mutex.try_lock() == false) {
@@ -99,8 +97,7 @@ int
SDL_mutexV(SDL_mutex * mutex)
{
if (mutex == NULL) {
SDL_SetError("Passed a NULL mutex");
return -1;
return SDL_InvalidParamError("mutex");
}
mutex->cpp_mutex.unlock();