mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-09-14 23:38:14 +00:00
use SDL_InvalidParamError or SDL_assert instead of custom SDL_SetError
This commit is contained in:
@@ -70,8 +70,7 @@ int
|
||||
SDL_CondSignal(SDL_cond * cond)
|
||||
{
|
||||
if (!cond) {
|
||||
SDL_SetError("Passed a NULL condition variable");
|
||||
return -1;
|
||||
return SDL_InvalidParamError("cond");
|
||||
}
|
||||
|
||||
cond->cpp_cond.notify_one();
|
||||
@@ -84,8 +83,7 @@ int
|
||||
SDL_CondBroadcast(SDL_cond * cond)
|
||||
{
|
||||
if (!cond) {
|
||||
SDL_SetError("Passed a NULL condition variable");
|
||||
return -1;
|
||||
return SDL_InvalidParamError("cond");
|
||||
}
|
||||
|
||||
cond->cpp_cond.notify_all();
|
||||
@@ -118,13 +116,11 @@ int
|
||||
SDL_CondWaitTimeout(SDL_cond * cond, SDL_mutex * mutex, Uint32 ms)
|
||||
{
|
||||
if (!cond) {
|
||||
SDL_SetError("Passed a NULL condition variable");
|
||||
return -1;
|
||||
return SDL_InvalidParamError("cond");
|
||||
}
|
||||
|
||||
if (!mutex) {
|
||||
SDL_SetError("Passed a NULL mutex variable");
|
||||
return -1;
|
||||
return SDL_InvalidParamError("mutex");
|
||||
}
|
||||
|
||||
try {
|
||||
@@ -148,8 +144,7 @@ SDL_CondWaitTimeout(SDL_cond * cond, SDL_mutex * mutex, Uint32 ms)
|
||||
}
|
||||
}
|
||||
} catch (std::system_error & ex) {
|
||||
SDL_SetError("unable to wait on a C++ condition variable: code=%d; %s", ex.code(), ex.what());
|
||||
return -1;
|
||||
return SDL_SetError("unable to wait on a C++ condition variable: code=%d; %s", ex.code(), ex.what());
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user