mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-11-12 05:18:40 +00:00
Pointer as bool (libsdl-org#7214)
This commit is contained in:
@@ -63,7 +63,7 @@ int SDL_SignalCondition(SDL_Condition *cond)
|
||||
{
|
||||
int retval;
|
||||
|
||||
if (cond == NULL) {
|
||||
if (!cond) {
|
||||
return SDL_InvalidParamError("cond");
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ int SDL_BroadcastCondition(SDL_Condition *cond)
|
||||
{
|
||||
int retval;
|
||||
|
||||
if (cond == NULL) {
|
||||
if (!cond) {
|
||||
return SDL_InvalidParamError("cond");
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ int SDL_WaitConditionTimeoutNS(SDL_Condition *cond, SDL_Mutex *mutex, Sint64 tim
|
||||
#endif
|
||||
struct timespec abstime;
|
||||
|
||||
if (cond == NULL) {
|
||||
if (!cond) {
|
||||
return SDL_InvalidParamError("cond");
|
||||
}
|
||||
|
||||
|
||||
@@ -88,7 +88,7 @@ int SDL_TryLockMutex(SDL_Mutex *mutex)
|
||||
{
|
||||
int retval = 0;
|
||||
|
||||
if (mutex != NULL) {
|
||||
if (mutex) {
|
||||
#ifdef FAKE_RECURSIVE_MUTEX
|
||||
pthread_t this_thread = pthread_self();
|
||||
if (mutex->owner == this_thread) {
|
||||
|
||||
@@ -42,7 +42,7 @@ struct SDL_Semaphore
|
||||
SDL_Semaphore *SDL_CreateSemaphore(Uint32 initial_value)
|
||||
{
|
||||
SDL_Semaphore *sem = (SDL_Semaphore *)SDL_malloc(sizeof(SDL_Semaphore));
|
||||
if (sem != NULL) {
|
||||
if (sem) {
|
||||
if (sem_init(&sem->sem, 0, initial_value) < 0) {
|
||||
SDL_SetError("sem_init() failed");
|
||||
SDL_free(sem);
|
||||
@@ -56,7 +56,7 @@ SDL_Semaphore *SDL_CreateSemaphore(Uint32 initial_value)
|
||||
|
||||
void SDL_DestroySemaphore(SDL_Semaphore *sem)
|
||||
{
|
||||
if (sem != NULL) {
|
||||
if (sem) {
|
||||
sem_destroy(&sem->sem);
|
||||
SDL_free(sem);
|
||||
}
|
||||
@@ -74,7 +74,7 @@ int SDL_WaitSemaphoreTimeoutNS(SDL_Semaphore *sem, Sint64 timeoutNS)
|
||||
Uint64 end;
|
||||
#endif
|
||||
|
||||
if (sem == NULL) {
|
||||
if (!sem) {
|
||||
return SDL_InvalidParamError("sem");
|
||||
}
|
||||
|
||||
@@ -152,7 +152,7 @@ Uint32 SDL_GetSemaphoreValue(SDL_Semaphore *sem)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
if (sem == NULL) {
|
||||
if (!sem) {
|
||||
SDL_InvalidParamError("sem");
|
||||
return 0;
|
||||
}
|
||||
@@ -168,7 +168,7 @@ int SDL_PostSemaphore(SDL_Semaphore *sem)
|
||||
{
|
||||
int retval;
|
||||
|
||||
if (sem == NULL) {
|
||||
if (!sem) {
|
||||
return SDL_InvalidParamError("sem");
|
||||
}
|
||||
|
||||
|
||||
@@ -118,10 +118,10 @@ void SDL_SYS_SetupThread(const char *name)
|
||||
int i;
|
||||
sigset_t mask;
|
||||
|
||||
if (name != NULL) {
|
||||
if (name) {
|
||||
#if (defined(__MACOS__) || defined(__IOS__) || defined(__LINUX__)) && defined(HAVE_DLOPEN)
|
||||
SDL_assert(checked_setname);
|
||||
if (ppthread_setname_np != NULL) {
|
||||
if (ppthread_setname_np) {
|
||||
#if defined(__MACOS__) || defined(__IOS__)
|
||||
ppthread_setname_np(name);
|
||||
#elif defined(__LINUX__)
|
||||
|
||||
Reference in New Issue
Block a user