mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-09-28 22:18:28 +00:00
use SDL_InvalidParamError or SDL_assert instead of custom SDL_SetError
This commit is contained in:
@@ -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");
|
||||
}
|
||||
|
@@ -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
|
||||
|
@@ -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);
|
||||
|
Reference in New Issue
Block a user