Make SDL_SetError and friends unconditionally return -1.
This lets us change things like this... if (Failed) { SDL_SetError("We failed"); return -1; } ...into this... if (Failed) { return SDL_SetError("We failed"); } Fixes Bugzilla #1778.
This commit is contained in:
parent
8c6b9f4743
commit
4f438b70a2
106 changed files with 616 additions and 1189 deletions
|
@ -82,8 +82,7 @@ int
|
|||
SDL_CondSignal(SDL_cond * cond)
|
||||
{
|
||||
if (!cond) {
|
||||
SDL_SetError("Passed a NULL condition variable");
|
||||
return -1;
|
||||
return SDL_SetError("Passed a NULL condition variable");
|
||||
}
|
||||
|
||||
/* If there are waiting threads not already signalled, then
|
||||
|
@ -107,8 +106,7 @@ int
|
|||
SDL_CondBroadcast(SDL_cond * cond)
|
||||
{
|
||||
if (!cond) {
|
||||
SDL_SetError("Passed a NULL condition variable");
|
||||
return -1;
|
||||
return SDL_SetError("Passed a NULL condition variable");
|
||||
}
|
||||
|
||||
/* If there are waiting threads not already signalled, then
|
||||
|
@ -164,8 +162,7 @@ SDL_CondWaitTimeout(SDL_cond * cond, SDL_mutex * mutex, Uint32 ms)
|
|||
int retval;
|
||||
|
||||
if (!cond) {
|
||||
SDL_SetError("Passed a NULL condition variable");
|
||||
return -1;
|
||||
return SDL_SetError("Passed a NULL condition variable");
|
||||
}
|
||||
|
||||
/* Obtain the protection mutex, and increment the number of waiters.
|
||||
|
|
|
@ -78,8 +78,7 @@ SDL_mutexP(SDL_mutex * mutex)
|
|||
SDL_threadID this_thread;
|
||||
|
||||
if (mutex == NULL) {
|
||||
SDL_SetError("Passed a NULL mutex");
|
||||
return -1;
|
||||
return SDL_SetError("Passed a NULL mutex");
|
||||
}
|
||||
|
||||
this_thread = SDL_ThreadID();
|
||||
|
@ -107,14 +106,12 @@ SDL_mutexV(SDL_mutex * mutex)
|
|||
return 0;
|
||||
#else
|
||||
if (mutex == NULL) {
|
||||
SDL_SetError("Passed a NULL mutex");
|
||||
return -1;
|
||||
return SDL_SetError("Passed a NULL mutex");
|
||||
}
|
||||
|
||||
/* If we don't own the mutex, we can't unlock it */
|
||||
if (SDL_ThreadID() != mutex->owner) {
|
||||
SDL_SetError("mutex not owned by this thread");
|
||||
return -1;
|
||||
return SDL_SetError("mutex not owned by this thread");
|
||||
}
|
||||
|
||||
if (mutex->recursive) {
|
||||
|
|
|
@ -105,8 +105,7 @@ int SDL_SemWaitTimeout(SDL_sem *sem, Uint32 timeout)
|
|||
case SCE_KERNEL_ERROR_WAIT_TIMEOUT:
|
||||
return SDL_MUTEX_TIMEDOUT;
|
||||
default:
|
||||
SDL_SetError("WaitForSingleObject() failed");
|
||||
return -1;
|
||||
return SDL_SetError("WaitForSingleObject() failed");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -142,14 +141,12 @@ int SDL_SemPost(SDL_sem *sem)
|
|||
int res;
|
||||
|
||||
if (sem == NULL) {
|
||||
SDL_SetError("Passed a NULL sem");
|
||||
return -1;
|
||||
return SDL_SetError("Passed a NULL sem");
|
||||
}
|
||||
|
||||
res = sceKernelSignalSema(sem->semid, 1);
|
||||
if (res < 0) {
|
||||
SDL_SetError("sceKernelSignalSema() failed");
|
||||
return -1;
|
||||
return SDL_SetError("sceKernelSignalSema() failed");
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -54,8 +54,7 @@ int SDL_SYS_CreateThread(SDL_Thread *thread, void *args)
|
|||
priority, 0x8000,
|
||||
PSP_THREAD_ATTR_VFPU, NULL);
|
||||
if (thread->handle < 0) {
|
||||
SDL_SetError("sceKernelCreateThread() failed");
|
||||
return -1;
|
||||
return SDL_SetError("sceKernelCreateThread() failed");
|
||||
}
|
||||
|
||||
sceKernelStartThread(thread->handle, 4, &args);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue