[SDL2] pointer boolean (#8523)

This commit is contained in:
Sylvain Becker 2023-11-10 15:30:56 +01:00 committed by GitHub
parent 4a3a9f3ad8
commit a14b948b6c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
394 changed files with 2564 additions and 2559 deletions

View file

@ -114,11 +114,11 @@ static void SDL_GenerateAssertionReport(void)
const SDL_assert_data *item = triggered_assertions;
/* only do this if the app hasn't assigned an assertion handler. */
if ((item != NULL) && (assertion_handler != SDL_PromptAssertion)) {
if ((item) && (assertion_handler != SDL_PromptAssertion)) {
debug_print("\n\nSDL assertion report.\n");
debug_print("All SDL assertions between last init/quit:\n\n");
while (item != NULL) {
while (item) {
debug_print(
"'%s'\n"
" * %s (%s:%d)\n"
@ -206,7 +206,7 @@ static SDL_assert_state SDLCALL SDL_PromptAssertion(const SDL_assert_data *data,
/* let env. variable override, so unit tests won't block in a GUI. */
envr = SDL_getenv("SDL_ASSERT");
if (envr != NULL) {
if (envr) {
if (message != stack_buf) {
SDL_free(message);
}
@ -342,9 +342,9 @@ SDL_assert_state SDL_ReportAssertion(SDL_assert_data *data, const char *func, co
#ifndef SDL_THREADS_DISABLED
static SDL_SpinLock spinlock = 0;
SDL_AtomicLock(&spinlock);
if (assertion_mutex == NULL) { /* never called SDL_Init()? */
if (!assertion_mutex) { /* never called SDL_Init()? */
assertion_mutex = SDL_CreateMutex();
if (assertion_mutex == NULL) {
if (!assertion_mutex) {
SDL_AtomicUnlock(&spinlock);
return SDL_ASSERTION_IGNORE; /* oh well, I guess. */
}
@ -409,7 +409,7 @@ void SDL_AssertionsQuit(void)
#if SDL_ASSERT_LEVEL > 0
SDL_GenerateAssertionReport();
#ifndef SDL_THREADS_DISABLED
if (assertion_mutex != NULL) {
if (assertion_mutex) {
SDL_DestroyMutex(assertion_mutex);
assertion_mutex = NULL;
}
@ -437,7 +437,7 @@ void SDL_ResetAssertionReport(void)
{
SDL_assert_data *next = NULL;
SDL_assert_data *item;
for (item = triggered_assertions; item != NULL; item = next) {
for (item = triggered_assertions; item; item = next) {
next = (SDL_assert_data *)item->next;
item->always_ignore = SDL_FALSE;
item->trigger_count = 0;
@ -454,7 +454,7 @@ SDL_AssertionHandler SDL_GetDefaultAssertionHandler(void)
SDL_AssertionHandler SDL_GetAssertionHandler(void **userdata)
{
if (userdata != NULL) {
if (userdata) {
*userdata = assertion_userdata;
}
return assertion_handler;