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

@@ -68,7 +68,7 @@ SDL_CondSignal(SDL_cond * cond)
int retval;
if (!cond) {
return SDL_SetError("Passed a NULL condition variable");
return SDL_InvalidParamError("cond");
}
retval = 0;
@@ -85,7 +85,7 @@ SDL_CondBroadcast(SDL_cond * cond)
int retval;
if (!cond) {
return SDL_SetError("Passed a NULL condition variable");
return SDL_InvalidParamError("cond");
}
retval = 0;
@@ -105,7 +105,7 @@ SDL_CondWaitTimeout(SDL_cond * cond, SDL_mutex * mutex, Uint32 ms)
struct timespec abstime;
if (!cond) {
return SDL_SetError("Passed a NULL condition variable");
return SDL_InvalidParamError("cond");
}
#ifdef HAVE_CLOCK_GETTIME
@@ -148,7 +148,7 @@ int
SDL_CondWait(SDL_cond * cond, SDL_mutex * mutex)
{
if (!cond) {
return SDL_SetError("Passed a NULL condition variable");
return SDL_InvalidParamError("cond");
} else if (pthread_cond_wait(&cond->cond, &mutex->id) != 0) {
return SDL_SetError("pthread_cond_wait() failed");
}

View File

@@ -85,7 +85,7 @@ SDL_LockMutex(SDL_mutex * mutex)
#endif
if (mutex == NULL) {
return SDL_SetError("Passed a NULL mutex");
return SDL_InvalidParamError("mutex");
}
#if FAKE_RECURSIVE_MUTEX
@@ -122,7 +122,7 @@ SDL_TryLockMutex(SDL_mutex * mutex)
#endif
if (mutex == NULL) {
return SDL_SetError("Passed a NULL mutex");
return SDL_InvalidParamError("mutex");
}
retval = 0;
@@ -162,7 +162,7 @@ int
SDL_UnlockMutex(SDL_mutex * mutex)
{
if (mutex == NULL) {
return SDL_SetError("Passed a NULL mutex");
return SDL_InvalidParamError("mutex");
}
#if FAKE_RECURSIVE_MUTEX

View File

@@ -73,7 +73,7 @@ SDL_SemTryWait(SDL_sem * sem)
int retval;
if (!sem) {
return SDL_SetError("Passed a NULL semaphore");
return SDL_InvalidParamError("sem");
}
retval = SDL_MUTEX_TIMEDOUT;
if (sem_trywait(&sem->sem) == 0) {
@@ -88,7 +88,7 @@ SDL_SemWait(SDL_sem * sem)
int retval;
if (!sem) {
return SDL_SetError("Passed a NULL semaphore");
return SDL_InvalidParamError("sem");
}
do {
@@ -115,7 +115,7 @@ SDL_SemWaitTimeout(SDL_sem * sem, Uint32 timeout)
#endif
if (!sem) {
return SDL_SetError("Passed a NULL semaphore");
return SDL_InvalidParamError("sem");
}
/* Try the easy cases first */
@@ -195,7 +195,7 @@ SDL_SemPost(SDL_sem * sem)
int retval;
if (!sem) {
return SDL_SetError("Passed a NULL semaphore");
return SDL_InvalidParamError("sem");
}
retval = sem_post(&sem->sem);