mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-03-31 12:52:03 +00:00
[SDL2] pointer boolean (#8523)
This commit is contained in:
@@ -64,7 +64,7 @@ int SDL_CondSignal(SDL_cond *cond)
|
||||
{
|
||||
int retval;
|
||||
|
||||
if (cond == NULL) {
|
||||
if (!cond) {
|
||||
return SDL_InvalidParamError("cond");
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@ int SDL_CondBroadcast(SDL_cond *cond)
|
||||
{
|
||||
int retval;
|
||||
|
||||
if (cond == NULL) {
|
||||
if (!cond) {
|
||||
return SDL_InvalidParamError("cond");
|
||||
}
|
||||
|
||||
@@ -99,7 +99,7 @@ int SDL_CondWaitTimeout(SDL_cond *cond, SDL_mutex *mutex, Uint32 ms)
|
||||
#endif
|
||||
struct timespec abstime;
|
||||
|
||||
if (cond == NULL) {
|
||||
if (!cond) {
|
||||
return SDL_InvalidParamError("cond");
|
||||
}
|
||||
|
||||
@@ -141,7 +141,7 @@ tryagain:
|
||||
*/
|
||||
int SDL_CondWait(SDL_cond *cond, SDL_mutex *mutex)
|
||||
{
|
||||
if (cond == NULL) {
|
||||
if (!cond) {
|
||||
return SDL_InvalidParamError("cond");
|
||||
} else if (pthread_cond_wait(&cond->cond, &mutex->id) != 0) {
|
||||
return SDL_SetError("pthread_cond_wait() failed");
|
||||
|
||||
@@ -117,7 +117,7 @@ int SDL_TryLockMutex(SDL_mutex *mutex)
|
||||
pthread_t this_thread;
|
||||
#endif
|
||||
|
||||
if (mutex == NULL) {
|
||||
if (!mutex) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ struct SDL_semaphore
|
||||
SDL_sem *SDL_CreateSemaphore(Uint32 initial_value)
|
||||
{
|
||||
SDL_sem *sem = (SDL_sem *)SDL_malloc(sizeof(SDL_sem));
|
||||
if (sem != NULL) {
|
||||
if (sem) {
|
||||
if (sem_init(&sem->sem, 0, initial_value) < 0) {
|
||||
SDL_SetError("sem_init() failed");
|
||||
SDL_free(sem);
|
||||
@@ -59,7 +59,7 @@ SDL_sem *SDL_CreateSemaphore(Uint32 initial_value)
|
||||
|
||||
void SDL_DestroySemaphore(SDL_sem *sem)
|
||||
{
|
||||
if (sem != NULL) {
|
||||
if (sem) {
|
||||
sem_destroy(&sem->sem);
|
||||
SDL_free(sem);
|
||||
}
|
||||
@@ -69,7 +69,7 @@ int SDL_SemTryWait(SDL_sem *sem)
|
||||
{
|
||||
int retval;
|
||||
|
||||
if (sem == NULL) {
|
||||
if (!sem) {
|
||||
return SDL_InvalidParamError("sem");
|
||||
}
|
||||
retval = SDL_MUTEX_TIMEDOUT;
|
||||
@@ -83,7 +83,7 @@ int SDL_SemWait(SDL_sem *sem)
|
||||
{
|
||||
int retval;
|
||||
|
||||
if (sem == NULL) {
|
||||
if (!sem) {
|
||||
return SDL_InvalidParamError("sem");
|
||||
}
|
||||
|
||||
@@ -109,7 +109,7 @@ int SDL_SemWaitTimeout(SDL_sem *sem, Uint32 timeout)
|
||||
Uint32 end;
|
||||
#endif
|
||||
|
||||
if (sem == NULL) {
|
||||
if (!sem) {
|
||||
return SDL_InvalidParamError("sem");
|
||||
}
|
||||
|
||||
@@ -175,7 +175,7 @@ Uint32 SDL_SemValue(SDL_sem *sem)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
if (sem == NULL) {
|
||||
if (!sem) {
|
||||
SDL_InvalidParamError("sem");
|
||||
return 0;
|
||||
}
|
||||
@@ -191,7 +191,7 @@ int SDL_SemPost(SDL_sem *sem)
|
||||
{
|
||||
int retval;
|
||||
|
||||
if (sem == NULL) {
|
||||
if (!sem) {
|
||||
return SDL_InvalidParamError("sem");
|
||||
}
|
||||
|
||||
|
||||
@@ -127,10 +127,10 @@ void SDL_SYS_SetupThread(const char *name)
|
||||
sigset_t mask;
|
||||
#endif /* !__NACL__ */
|
||||
|
||||
if (name != NULL) {
|
||||
if (name) {
|
||||
#if (defined(__MACOSX__) || defined(__IPHONEOS__) || defined(__LINUX__)) && defined(HAVE_DLOPEN)
|
||||
SDL_assert(checked_setname);
|
||||
if (ppthread_setname_np != NULL) {
|
||||
if (ppthread_setname_np) {
|
||||
#if defined(__MACOSX__) || defined(__IPHONEOS__)
|
||||
ppthread_setname_np(name);
|
||||
#elif defined(__LINUX__)
|
||||
|
||||
Reference in New Issue
Block a user