mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-10-02 16:08:30 +00:00
Pointer as bool (libsdl-org#7214)
This commit is contained in:
@@ -83,7 +83,7 @@ static SDL_Semaphore *SDL_CreateSemaphore_atom(Uint32 initial_value)
|
||||
SDL_sem_atom *sem;
|
||||
|
||||
sem = (SDL_sem_atom *)SDL_malloc(sizeof(*sem));
|
||||
if (sem != NULL) {
|
||||
if (sem) {
|
||||
sem->count = initial_value;
|
||||
} else {
|
||||
SDL_OutOfMemory();
|
||||
@@ -93,7 +93,7 @@ static SDL_Semaphore *SDL_CreateSemaphore_atom(Uint32 initial_value)
|
||||
|
||||
static void SDL_DestroySemaphore_atom(SDL_Semaphore *sem)
|
||||
{
|
||||
if (sem != NULL) {
|
||||
if (sem) {
|
||||
SDL_free(sem);
|
||||
}
|
||||
}
|
||||
@@ -106,7 +106,7 @@ static int SDL_WaitSemaphoreTimeoutNS_atom(SDL_Semaphore *_sem, Sint64 timeoutNS
|
||||
Uint64 deadline;
|
||||
DWORD timeout_eff;
|
||||
|
||||
if (sem == NULL) {
|
||||
if (!sem) {
|
||||
return SDL_InvalidParamError("sem");
|
||||
}
|
||||
|
||||
@@ -176,7 +176,7 @@ static Uint32 SDL_GetSemaphoreValue_atom(SDL_Semaphore *_sem)
|
||||
{
|
||||
SDL_sem_atom *sem = (SDL_sem_atom *)_sem;
|
||||
|
||||
if (sem == NULL) {
|
||||
if (!sem) {
|
||||
SDL_InvalidParamError("sem");
|
||||
return 0;
|
||||
}
|
||||
@@ -188,7 +188,7 @@ static int SDL_PostSemaphore_atom(SDL_Semaphore *_sem)
|
||||
{
|
||||
SDL_sem_atom *sem = (SDL_sem_atom *)_sem;
|
||||
|
||||
if (sem == NULL) {
|
||||
if (!sem) {
|
||||
return SDL_InvalidParamError("sem");
|
||||
}
|
||||
|
||||
@@ -224,7 +224,7 @@ static SDL_Semaphore *SDL_CreateSemaphore_kern(Uint32 initial_value)
|
||||
|
||||
/* Allocate sem memory */
|
||||
sem = (SDL_sem_kern *)SDL_malloc(sizeof(*sem));
|
||||
if (sem != NULL) {
|
||||
if (sem) {
|
||||
/* Create the semaphore, with max value 32K */
|
||||
#ifdef __WINRT__
|
||||
sem->id = CreateSemaphoreEx(NULL, initial_value, 32 * 1024, NULL, 0, SEMAPHORE_ALL_ACCESS);
|
||||
@@ -247,7 +247,7 @@ static SDL_Semaphore *SDL_CreateSemaphore_kern(Uint32 initial_value)
|
||||
static void SDL_DestroySemaphore_kern(SDL_Semaphore *_sem)
|
||||
{
|
||||
SDL_sem_kern *sem = (SDL_sem_kern *)_sem;
|
||||
if (sem != NULL) {
|
||||
if (sem) {
|
||||
if (sem->id) {
|
||||
CloseHandle(sem->id);
|
||||
sem->id = 0;
|
||||
@@ -262,7 +262,7 @@ static int SDL_WaitSemaphoreTimeoutNS_kern(SDL_Semaphore *_sem, Sint64 timeoutNS
|
||||
int retval;
|
||||
DWORD dwMilliseconds;
|
||||
|
||||
if (sem == NULL) {
|
||||
if (!sem) {
|
||||
return SDL_InvalidParamError("sem");
|
||||
}
|
||||
|
||||
@@ -290,7 +290,7 @@ static int SDL_WaitSemaphoreTimeoutNS_kern(SDL_Semaphore *_sem, Sint64 timeoutNS
|
||||
static Uint32 SDL_GetSemaphoreValue_kern(SDL_Semaphore *_sem)
|
||||
{
|
||||
SDL_sem_kern *sem = (SDL_sem_kern *)_sem;
|
||||
if (sem == NULL) {
|
||||
if (!sem) {
|
||||
SDL_InvalidParamError("sem");
|
||||
return 0;
|
||||
}
|
||||
@@ -300,7 +300,7 @@ static Uint32 SDL_GetSemaphoreValue_kern(SDL_Semaphore *_sem)
|
||||
static int SDL_PostSemaphore_kern(SDL_Semaphore *_sem)
|
||||
{
|
||||
SDL_sem_kern *sem = (SDL_sem_kern *)_sem;
|
||||
if (sem == NULL) {
|
||||
if (!sem) {
|
||||
return SDL_InvalidParamError("sem");
|
||||
}
|
||||
/* Increase the counter in the first place, because
|
||||
@@ -330,7 +330,7 @@ static const SDL_sem_impl_t SDL_sem_impl_kern = {
|
||||
|
||||
SDL_Semaphore *SDL_CreateSemaphore(Uint32 initial_value)
|
||||
{
|
||||
if (SDL_sem_impl_active.Create == NULL) {
|
||||
if (!SDL_sem_impl_active.Create) {
|
||||
/* Default to fallback implementation */
|
||||
const SDL_sem_impl_t *impl = &SDL_sem_impl_kern;
|
||||
|
||||
|
Reference in New Issue
Block a user