SDL: Re-add SDL_assert() with non boolean ptr syntax (#8531)

From f3419d8c0492600599b4e183c0ff90f2ce2b09ef Mon Sep 17 00:00:00 2001
From: Sylvain Becker <[EMAIL REDACTED]>
Date: Sat, 11 Nov 2023 10:29:05 +0100
Subject: [PATCH] Re-add SDL_assert() with non boolean ptr syntax (#8531)

---
 src/SDL_dataqueue.c                       |  6 +++---
 src/audio/aaudio/SDL_aaudio.c             |  4 ++--
 src/audio/alsa/SDL_alsa_audio.c           |  2 +-
 src/audio/android/SDL_androidaudio.c      |  4 ++--
 src/audio/directsound/SDL_directsound.c   |  2 +-
 src/audio/pipewire/SDL_pipewire.c         |  4 ++--
 src/audio/pulseaudio/SDL_pulseaudio.c     | 12 ++++++------
 src/audio/wasapi/SDL_wasapi.c             | 10 +++++-----
 src/audio/wasapi/SDL_wasapi_win32.c       |  4 ++--
 src/core/linux/SDL_evdev.c                |  6 +++---
 src/core/windows/SDL_immdevice.c          |  4 ++--
 src/events/SDL_keyboard.c                 |  2 +-
 src/filesystem/haiku/SDL_sysfilesystem.cc |  2 +-
 src/filesystem/unix/SDL_sysfilesystem.c   |  2 +-
 src/haptic/android/SDL_syshaptic.c        |  2 +-
 src/haptic/darwin/SDL_syshaptic.c         |  2 +-
 src/haptic/linux/SDL_syshaptic.c          |  2 +-
 src/haptic/windows/SDL_windowshaptic.c    |  2 +-
 src/joystick/android/SDL_sysjoystick.c    |  2 +-
 src/joystick/bsd/SDL_bsdjoystick.c        |  2 +-
 src/joystick/linux/SDL_sysjoystick.c      |  6 +++---
 src/locale/windows/SDL_syslocale.c        |  2 +-
 src/render/SDL_render.c                   | 18 +++++++++---------
 src/render/direct3d/SDL_render_d3d.c      |  2 +-
 src/render/software/SDL_render_sw.c       |  2 +-
 src/test/SDL_test_memory.c                |  2 +-
 src/video/SDL_shape.c                     |  2 +-
 src/video/SDL_video.c                     |  6 +++---
 src/video/directfb/SDL_DirectFB_shape.c   |  2 +-
 src/video/wayland/SDL_waylandmouse.c      |  2 +-
 src/video/windows/SDL_windowsopengl.c     |  4 ++--
 src/video/x11/SDL_x11events.c             |  2 +-
 src/video/x11/SDL_x11modes.c              |  2 +-
 src/video/x11/SDL_x11shape.c              |  2 +-
 src/video/x11/SDL_x11xfixes.c             |  2 +-
 src/video/x11/SDL_x11xinput2.c            |  4 ++--
 test/testautomation_surface.c             | 10 +++++-----
 37 files changed, 73 insertions(+), 73 deletions(-)

diff --git a/src/SDL_dataqueue.c b/src/SDL_dataqueue.c
index 4176f1361ace..eaabdcc20610 100644
--- a/src/SDL_dataqueue.c
+++ b/src/SDL_dataqueue.c
@@ -144,7 +144,7 @@ static SDL_DataQueuePacket *AllocateDataQueuePacket(SDL_DataQueue *queue)
 {
     SDL_DataQueuePacket *packet;
 
-    SDL_assert(queue);
+    SDL_assert(queue != NULL);
 
     packet = queue->pool;
     if (packet) {
@@ -194,7 +194,7 @@ int SDL_WriteToDataQueue(SDL_DataQueue *queue, const void *_data, const size_t _
 
     while (len > 0) {
         SDL_DataQueuePacket *packet = queue->tail;
-        SDL_assert(!packet || (packet->datalen <= packet_size));
+        SDL_assert(packet == NULL || (packet->datalen <= packet_size));
         if (!packet || (packet->datalen >= packet_size)) {
             /* tail packet missing or completely full; we need a new packet. */
             packet = AllocateDataQueuePacket(queue);
@@ -286,7 +286,7 @@ SDL_ReadFromDataQueue(SDL_DataQueue *queue, void *_buf, const size_t _len)
 
         if (packet->startpos == packet->datalen) { /* packet is done, put it in the pool. */
             queue->head = packet->next;
-            SDL_assert((packet->next) || (packet == queue->tail));
+            SDL_assert((packet->next != NULL) || (packet == queue->tail));
             packet->next = queue->pool;
             queue->pool = packet;
         }
diff --git a/src/audio/aaudio/SDL_aaudio.c b/src/audio/aaudio/SDL_aaudio.c
index 4e389a157c2a..535c8e2df44c 100644
--- a/src/audio/aaudio/SDL_aaudio.c
+++ b/src/audio/aaudio/SDL_aaudio.c
@@ -77,8 +77,8 @@ static int aaudio_OpenDevice(_THIS, const char *devname)
     aaudio_result_t res;
     LOGI(__func__);
 
-    SDL_assert((!captureDevice) || !iscapture);
-    SDL_assert((!audioDevice) || iscapture);
+    SDL_assert((captureDevice == NULL) || !iscapture);
+    SDL_assert((audioDevice == NULL) || iscapture);
 
     if (iscapture) {
         if (!Android_JNI_RequestPermission("android.permission.RECORD_AUDIO")) {
diff --git a/src/audio/alsa/SDL_alsa_audio.c b/src/audio/alsa/SDL_alsa_audio.c
index ab837f6cb221..60238b8f7762 100644
--- a/src/audio/alsa/SDL_alsa_audio.c
+++ b/src/audio/alsa/SDL_alsa_audio.c
@@ -735,7 +735,7 @@ static void add_device(const int iscapture, const char *name, void *hint, ALSA_D
         desc = (char *)name;
     }
 
-    SDL_assert(name);
+    SDL_assert(name != NULL);
 
     /* some strings have newlines, like "HDA NVidia, HDMI 0\nHDMI Audio Output".
        just chop the extra lines off, this seems to get a reasonable device
diff --git a/src/audio/android/SDL_androidaudio.c b/src/audio/android/SDL_androidaudio.c
index 03874d0eb50d..ab570e55a175 100644
--- a/src/audio/android/SDL_androidaudio.c
+++ b/src/audio/android/SDL_androidaudio.c
@@ -41,8 +41,8 @@ static int ANDROIDAUDIO_OpenDevice(_THIS, const char *devname)
     SDL_AudioFormat test_format;
     SDL_bool iscapture = this->iscapture;
 
-    SDL_assert((!captureDevice) || !iscapture);
-    SDL_assert((!audioDevice) || iscapture);
+    SDL_assert((captureDevice == NULL) || !iscapture);
+    SDL_assert((audioDevice == NULL) || iscapture);
 
     if (iscapture) {
         captureDevice = this;
diff --git a/src/audio/directsound/SDL_directsound.c b/src/audio/directsound/SDL_directsound.c
index 99755b812ae7..5d5225e2a15c 100644
--- a/src/audio/directsound/SDL_directsound.c
+++ b/src/audio/directsound/SDL_directsound.c
@@ -354,7 +354,7 @@ static int DSOUND_CaptureFromDevice(_THIS, void *buffer, int buflen)
     }
 
     SDL_assert(ptr1len == this->spec.size);
-    SDL_assert(!ptr2);
+    SDL_assert(ptr2 == NULL);
     SDL_assert(ptr2len == 0);
 
     SDL_memcpy(buffer, ptr1, ptr1len);
diff --git a/src/audio/pipewire/SDL_pipewire.c b/src/audio/pipewire/SDL_pipewire.c
index 60dde24fd58d..aa713f0046a7 100644
--- a/src/audio/pipewire/SDL_pipewire.c
+++ b/src/audio/pipewire/SDL_pipewire.c
@@ -399,7 +399,7 @@ static struct io_node *io_list_get_by_path(char *path)
 
 static void node_object_destroy(struct node_object *node)
 {
-    SDL_assert(node);
+    SDL_assert(node != NULL);
 
     spa_list_remove(&node->link);
     spa_hook_remove(&node->node_listener);
@@ -411,7 +411,7 @@ static void node_object_destroy(struct node_object *node)
 /* The pending node list */
 static void pending_list_add(struct node_object *node)
 {
-    SDL_assert(node);
+    SDL_assert(node != NULL);
     spa_list_append(&hotplug_pending_list, &node->link);
 }
 
diff --git a/src/audio/pulseaudio/SDL_pulseaudio.c b/src/audio/pulseaudio/SDL_pulseaudio.c
index 1d8d0cc91d75..339106df5587 100644
--- a/src/audio/pulseaudio/SDL_pulseaudio.c
+++ b/src/audio/pulseaudio/SDL_pulseaudio.c
@@ -275,7 +275,7 @@ static const char *getAppName(void)
 static void WaitForPulseOperation(pa_operation *o)
 {
     /* This checks for NO errors currently. Either fix that, check results elsewhere, or do things you don't care about. */
-    SDL_assert(pulseaudio_threaded_mainloop);
+    SDL_assert(pulseaudio_threaded_mainloop != NULL);
     if (o) {
         while (PULSEAUDIO_pa_operation_get_state(o) == PA_OPERATION_RUNNING) {
             PULSEAUDIO_pa_threaded_mainloop_wait(pulseaudio_threaded_mainloop);  /* this releases the lock and blocks on an internal condition variable. */
@@ -310,8 +310,8 @@ static int ConnectToPulseServer(void)
     pa_mainloop_api *mainloop_api = NULL;
     int state = 0;
 
-    SDL_assert(!pulseaudio_threaded_mainloop);
-    SDL_assert(!pulseaudio_context);
+    SDL_assert(pulseaudio_threaded_mainloop == NULL);
+    SDL_assert(pulseaudio_context == NULL);
 
     /* Set up a new main loop */
     if (!(pulseaudio_threaded_mainloop = PULSEAUDIO_pa_threaded_mainloop_new())) {
@@ -331,7 +331,7 @@ static int ConnectToPulseServer(void)
     PULSEAUDIO_pa_threaded_mainloop_lock(pulseaudio_threaded_mainloop);
 
     mainloop_api = PULSEAUDIO_pa_threaded_mainloop_get_api(pulseaudio_threaded_mainloop);
-    SDL_assert(mainloop_api); /* this never fails, right? */
+    SDL_assert(mainloop_api != NULL); /* this never fails, right? */
 
     pulseaudio_context = PULSEAUDIO_pa_context_new(mainloop_api, getAppName());
     if (!pulseaudio_context) {
@@ -596,8 +596,8 @@ static int PULSEAUDIO_OpenDevice(_THIS, const char *devname)
     int format = PA_SAMPLE_INVALID;
     int retval = 0;
 
-    SDL_assert(pulseaudio_threaded_mainloop);
-    SDL_assert(pulseaudio_context);
+    SDL_assert(pulseaudio_threaded_mainloop != NULL);
+    SDL_assert(pulseaudio_context != NULL);
 
     /* Initialize all variables that we clean on shutdown */
     h = this->hidden = (struct SDL_PrivateAudioData *)SDL_malloc(sizeof(*this->hidden));
diff --git a/src/audio/wasapi/SDL_wasapi.c b/src/audio/wasapi/SDL_wasapi.c
index fa1e7f546b2f..1d66a38316f6 100644
--- a/src/audio/wasapi/SDL_wasapi.c
+++ b/src/audio/wasapi/SDL_wasapi.c
@@ -181,7 +181,7 @@ static Uint8 *WASAPI_GetDeviceBuf(_THIS)
         if (!WasapiFailed(this, IAudioRenderClient_GetBuffer(this->hidden->render, this->spec.samples, &buffer))) {
             return (Uint8 *)buffer;
         }
-        SDL_assert(!buffer);
+        SDL_assert(buffer == NULL);
     }
 
     return (Uint8 *)buffer;
@@ -407,7 +407,7 @@ int WASAPI_PrepDevice(_THIS, const SDL_bool updatestream)
     HRESULT ret = S_OK;
     DWORD streamflags = 0;
 
-    SDL_assert(client);
+    SDL_assert(client != NULL);
 
 #if defined(__WINRT__) || defined(__GDK__) /* CreateEventEx() arrived in Vista, so we need an #ifdef for XP. */
     this->hidden->event = CreateEventEx(NULL, NULL, 0, EVENT_ALL_ACCESS);
@@ -424,7 +424,7 @@ int WASAPI_PrepDevice(_THIS, const SDL_bool updatestream)
         return WIN_SetErrorFromHRESULT("WASAPI can't determine mix format", ret);
     }
 
-    SDL_assert(waveformat);
+    SDL_assert(waveformat != NULL);
     this->hidden->waveformat = waveformat;
 
     this->spec.channels = (Uint8)waveformat->nChannels;
@@ -502,7 +502,7 @@ int WASAPI_PrepDevice(_THIS, const SDL_bool updatestream)
             return WIN_SetErrorFromHRESULT("WASAPI can't get capture client service", ret);
         }
 
-        SDL_assert(capture);
+        SDL_assert(capture != NULL);
         this->hidden->capture = capture;
         ret = IAudioClient_Start(client);
         if (FAILED(ret)) {
@@ -516,7 +516,7 @@ int WASAPI_PrepDevice(_THIS, const SDL_bool updatestream)
             return WIN_SetErrorFromHRESULT("WASAPI can't get render client service", ret);
         }
 
-        SDL_assert(render);
+        SDL_assert(render != NULL);
         this->hidden->render = render;
         ret = IAudioClient_Start(client);
         if (FAILED(ret)) {
diff --git a/src/audio/wasapi/SDL_wasapi_win32.c b/src/audio/wasapi/SDL_wasapi_win32.c
index 1b31311aa2ba..965e7ff695ce 100644
--- a/src/audio/wasapi/SDL_wasapi_win32.c
+++ b/src/audio/wasapi/SDL_wasapi_win32.c
@@ -120,11 +120,11 @@ int WASAPI_ActivateDevice(_THIS, const SDL_bool isrecovery)
     IMMDevice_Release(device);
 
     if (FAILED(ret)) {
-        SDL_assert(!this->hidden->client);
+        SDL_assert(this->hidden->client == NULL);
         return WIN_SetErrorFromHRESULT("WASAPI can't activate audio endpoint", ret);
     }
 
-    SDL_assert(this->hidden->client);
+    SDL_assert(this->hidden->client != NULL);
     if (WASAPI_PrepDevice(this, isrecovery) == -1) { /* not async, fire it right away. */
         return -1;
     }
diff --git a/src/core/linux/SDL_evdev.c b/src/core/linux/SDL_evdev.c
index cd27e2f16fbf..e8ae6ccff215 100644
--- a/src/core/linux/SDL_evdev.c
+++ b/src/core/linux/SDL_evdev.c
@@ -245,8 +245,8 @@ void SDL_EVDEV_Quit(void)
 
         SDL_EVDEV_kbd_quit(_this->kbd);
 
-        SDL_assert(!_this->first);
-        SDL_assert(!_this->last);
+        SDL_assert(_this->first == NULL);
+        SDL_assert(_this->last == NULL);
         SDL_assert(_this->num_devices == 0);
 
         SDL_free(_this);
@@ -287,7 +287,7 @@ void SDL_EVDEV_SetVTSwitchCallbacks(void (*release_callback)(void*), void *relea
                                     void (*acquire_callback)(void*), void *acquire_callback_data)
 {
     SDL_EVDEV_kbd_set_vt_switch_callbacks(_this->kbd,
-                                          release_callback, release_callback_data, 
+                                          release_callback, release_callback_data,
                                           acquire_callback, acquire_callback_data);
 }
 
diff --git a/src/core/windows/SDL_immdevice.c b/src/core/windows/SDL_immdevice.c
index 93ca729ab0cf..f8d893170c91 100644
--- a/src/core/windows/SDL_immdevice.c
+++ b/src/core/windows/SDL_immdevice.c
@@ -361,7 +361,7 @@ int SDL_IMMDevice_Get(LPCWSTR devid, IMMDevice **device, SDL_bool iscapture)
     const Uint64 timeout = SDL_GetTicks64() + 8000;  /* intel's audio drivers can fail for up to EIGHT SECONDS after a device is connected or we wake from sleep. */
     HRESULT ret;
 
-    SDL_assert(device);
+    SDL_assert(device != NULL);
 
     while (SDL_TRUE) {
         if (!devid) {
@@ -496,7 +496,7 @@ int SDL_IMMDevice_GetDefaultAudioInfo(char **name, SDL_AudioSpec *spec, int isca
     HRESULT ret = IMMDeviceEnumerator_GetDefaultAudioEndpoint(enumerator, dataflow, SDL_IMMDevice_role, &device);
 
     if (FAILED(ret)) {
-        SDL_assert(!device);
+        SDL_assert(device == NULL);
         return WIN_SetErrorFromHRESULT("WASAPI can't find default audio endpoint", ret);
     }
 
diff --git a/src/events/SDL_keyboard.c b/src/events/SDL_keyboard.c
index a5ac86e3d168..d75f7ae71fa0 100644
--- a/src/events/SDL_keyboard.c
+++ b/src/events/SDL_keyboard.c
@@ -777,7 +777,7 @@ void SDL_SetKeyboardFocus(SDL_Window *window)
     if (keyboard->focus && keyboard->focus != window) {
 
         /* new window shouldn't think it has mouse captured. */
-        SDL_assert(!window || !(window->flags & SDL_WINDOW_MOUSE_CAPTURE));
+        SDL_assert(window == NULL || !(window->flags & SDL_WINDOW_MOUSE_CAPTURE));
 
         /* old window must lose an existing mouse capture. */
         if (keyboard->focus->flags & SDL_WINDOW_MOUSE_CAPTURE) {
diff --git a/src/filesystem/haiku/SDL_sysfilesystem.cc b/src/filesystem/haiku/SDL_sysfilesystem.cc
index af039d5b3f6c..e84b1a35e7e4 100644
--- a/src/filesystem/haiku/SDL_sysfilesystem.cc
+++ b/src/filesystem/haiku/SDL_sysfilesystem.cc
@@ -52,7 +52,7 @@ char *SDL_GetBasePath(void)
     rc = path.GetParent(&path); /* chop filename, keep directory. */
     SDL_assert(rc == B_OK);
     const char *str = path.Path();
-    SDL_assert(str);
+    SDL_assert(str != NULL);
 
     const size_t len = SDL_strlen(str);
     char *retval = (char *) SDL_malloc(len + 2);
diff --git a/src/filesystem/unix/SDL_sysfilesystem.c b/src/filesystem/unix/SDL_sysfilesystem.c
index 96a10396af00..9e5b03167e2a 100644
--- a/src/filesystem/unix/SDL_sysfilesystem.c
+++ b/src/filesystem/unix/SDL_sysfilesystem.c
@@ -97,7 +97,7 @@ static char *search_path_for_binary(const char *bin)
         return NULL;
     }
 
-    SDL_assert(bin);
+    SDL_assert(bin != NULL);
 
     alloc_size = SDL_strlen(bin) + SDL_strlen(envr) + 2;
     exe = (char *)SDL_malloc(alloc_size);
diff --git a/src/haptic/android/SDL_syshaptic.c b/src/haptic/android/SDL_syshaptic.c
index a673532ac51a..726fdea8bf85 100644
--- a/src/haptic/android/SDL_syshaptic.c
+++ b/src/haptic/android/SDL_syshaptic.c
@@ -70,7 +70,7 @@ static SDL_hapticlist_item *HapticByOrder(int index)
         return NULL;
     }
     while (index > 0) {
-        SDL_assert(item);
+        SDL_assert(item != NULL);
         --index;
         item = item->next;
     }
diff --git a/src/haptic/darwin/SDL_syshaptic.c b/src/haptic/darwin/SDL_syshaptic.c
index 3e4021ba7be7..15142f0e188d 100644
--- a/src/haptic/darwin/SDL_syshaptic.c
+++ b/src/haptic/darwin/SDL_syshaptic.c
@@ -196,7 +196,7 @@ static SDL_hapticlist_item *HapticByDevIndex(int device_index)
     }
 
     while (device_index > 0) {
-        SDL_assert(item);
+        SDL_assert(item != NULL);
         --device_index;
         item = item->next;
     }
diff --git a/src/haptic/linux/SDL_syshaptic.c b/src/haptic/linux/SDL_syshaptic.c
index a9b4c2737b01..c10af57e9e29 100644
--- a/src/haptic/linux/SDL_syshaptic.c
+++ b/src/haptic/linux/SDL_syshaptic.c
@@ -195,7 +195,7 @@ static SDL_hapticlist_item *HapticByDevIndex(int device_index)
     }
 
     while (device_index > 0) {
-        SDL_assert(item);
+        SDL_assert(item != NULL);
         --device_index;
         item = item->next;
     }
diff --git a/src/haptic/windows/SDL_windowshaptic.c b/src/haptic/windows/SDL_windowshaptic.c
index a70c3321258b..530eb91da943 100644
--- a/src/haptic/windows/SDL_windowshaptic.c
+++ b/src/haptic/windows/SDL_windowshaptic.c
@@ -126,7 +126,7 @@ static SDL_hapticlist_item *HapticByDevIndex(int device_index)
     }
 
     while (device_index > 0) {
-        SDL_assert(item);
+        SDL_assert(item != NULL);
         --device_index;
         item = item->next;
     }
diff --git a/src/joystick/android/SDL_sysjoystick.c b/src/joystick/android/SDL_sysjoystick.c
index 96488f36b6ad..9b7fd8345714 100644
--- a/src/joystick/android/SDL_sysjoystick.c
+++ b/src/joystick/android/SDL_sysjoystick.c
@@ -500,7 +500,7 @@ static SDL_joylist_item *JoystickByDevIndex(int device_index)
     }
 
     while (device_index > 0) {
-        SDL_assert(item);
+        SDL_assert(item != NULL);
         device_index--;
         item = item->next;
     }
diff --git a/src/joystick/bsd/SDL_bsdjoystick.c b/src/joystick/bsd/SDL_bsdjoystick.c
index d380f68f27d0..bb3f5446278e 100644
--- a/src/joystick/bsd/SDL_bsdjoystick.c
+++ b/src/joystick/bsd/SDL_bsdjoystick.c
@@ -556,7 +556,7 @@ static SDL_joylist_item *JoystickByDevIndex(int device_index)
     }
 
     while (device_index > 0) {
-        SDL_assert(item);
+        SDL_assert(item != NULL);
         device_index--;
         item = item->next;
     }
diff --git a/src/joystick/linux/SDL_sysjoystick.c b/src/joystick/linux/SDL_sysjoystick.c
index b849dfed2020..94621ddc995c 100644
--- a/src/joystick/linux/SDL_sysjoystick.c
+++ b/src/joystick/linux/SDL_sysjoystick.c
@@ -997,7 +997,7 @@ static SDL_joylist_item *JoystickByDevIndex(int device_index)
 
     item = SDL_joylist;
     while (device_index > 0) {
-        SDL_assert(item);
+        SDL_assert(item != NULL);
         device_index--;
         item = item->next;
     }
@@ -1504,8 +1504,8 @@ static int LINUX_JoystickOpen(SDL_Joystick *joystick, int device_index)
         return -1; /* SDL_SetError will already have been called */
     }
 
-    SDL_assert(!item->hwdata);
-    SDL_assert(!item_sensor || !item_sensor->hwdata);
+    SDL_assert(item->hwdata == NULL);
+    SDL_assert(!item_sensor || item_sensor->hwdata == NULL);
     item->hwdata = joystick->hwdata;
     if (item_sensor) {
         item_sensor->hwdata = joystick->hwdata;
diff --git a/src/locale/windows/SDL_syslocale.c b/src/locale/windows/SDL_syslocale.c
index 3a0472b47d04..7a8001509299 100644
--- a/src/locale/windows/SDL_syslocale.c
+++ b/src/locale/windows/SDL_syslocale.c
@@ -61,7 +61,7 @@ static void SDL_SYS_GetPreferredLocales_vista(char *buf, size_t buflen)
     ULONG wbuflen = 0;
     SDL_bool isstack;
 
-    SDL_assert(pGetUserPreferredUILanguages);
+    SDL_assert(pGetUserPreferredUILanguages != NULL);
     pGetUserPreferredUILanguages(MUI_LANGUAGE_NAME, &numlangs, NULL, &wbuflen);
 
     wbuf = SDL_small_alloc(WCHAR, wbuflen, &isstack);
diff --git a/src/render/SDL_render.c b/src/render/SDL_render.c
index b67b353bf78e..eb717209e158 100644
--- a/src/render/SDL_render.c
+++ b/src/render/SDL_render.c
@@ -237,7 +237,7 @@ static int FlushRenderCommands(SDL_Renderer *renderer)
 {
     int retval;
 
-    SDL_assert((!renderer->render_commands) == (!renderer->render_commands_tail));
+    SDL_assert((renderer->render_commands == NULL) == (renderer->render_commands_tail == NULL));
 
     if (!renderer->render_commands) { /* nothing to do! */
         SDL_assert(renderer->vertex_data_used == 0);
@@ -335,7 +335,7 @@ static SDL_RenderCommand *AllocateRenderCommand(SDL_Renderer *renderer)
         }
     }
 
-    SDL_assert((!renderer->render_commands) == (!renderer->render_commands_tail));
+    SDL_assert((renderer->render_commands == NULL) == (renderer->render_commands_tail == NULL));
     if (renderer->render_commands_tail) {
         renderer->render_commands_tail->next = retval;
     } else {
@@ -883,13 +883,13 @@ static SDL_INLINE void VerifyDrawQueueFunctions(const SDL_Renderer *renderer)
 {
     /* all of these functions are required to be implemented, even as no-ops, so we don't
         have to check that they aren't NULL over and over. */
-    SDL_assert(renderer->QueueSetViewport);
-    SDL_assert(renderer->QueueSetDrawColor);
-    SDL_assert(renderer->QueueDrawPoints);
-    SDL_assert(renderer->QueueDrawLines || renderer->QueueGeometry);
-    SDL_assert(renderer->QueueFillRects || renderer->QueueGeometry);
-    SDL_assert(renderer->QueueCopy || renderer->QueueGeometry);
-    SDL_assert(renderer->RunCommandQueue);
+    SDL_assert(renderer->QueueSetViewport != NULL);
+    SDL_assert(renderer->QueueSetDrawColor != NULL);
+    SDL_assert(renderer->QueueDrawPoints != NULL);
+    SDL_assert(renderer->QueueDrawLines != NULL || renderer->QueueGeometry != NULL);
+    SDL_assert(renderer->QueueFillRects != NULL || renderer->QueueGeometry != NULL);
+    SDL_assert(renderer->QueueCopy != NULL || renderer->QueueGeometry != NULL);
+    SDL_assert(renderer->RunCommandQueue != NULL);
 }
 
 static SDL_RenderLineMethod SDL_GetRenderLineMethod()
diff --git a/src/render/direct3d/SDL_render_d3d.c b/src/render/direct3d/SDL_render_d3d.c
index 03e4070302a1..4524debacebf 100644
--- a/src/render/direct3d/SDL_render_d3d.c
+++ b/src/render/direct3d/SDL_render_d3d.c
@@ -939,7 +939,7 @@ static int SetupTextureState(D3D_RenderData *data, SDL_Texture *texture, LPDIREC
 {
     D3D_TextureData *texturedata = (D3D_TextureData *)texture->driverdata;
 
-    SDL_assert(!*shader);
+    SDL_assert(*shader == NULL);
 
     if (!texturedata) {
         return SDL_SetError("Texture is not currently available");
diff --git a/src/render/software/SDL_render_sw.c b/src/render/software/SDL_render_sw.c
index 6420b108a1ce..3c10313ccc89 100644
--- a/src/render/software/SDL_render_sw.c
+++ b/src/render/software/SDL_render_sw.c
@@ -641,7 +641,7 @@ static void SetDrawState(SDL_Surface *surface, SW_DrawStateCache *drawstate)
     if (drawstate->surface_cliprect_dirty) {
         const SDL_Rect *viewport = drawstate->viewport;
         const SDL_Rect *cliprect = drawstate->cliprect;
-        SDL_assert_release(viewport); /* the higher level should have forced a SDL_RENDERCMD_SETVIEWPORT */
+        SDL_assert_release(viewport != NULL); /* the higher level should have forced a SDL_RENDERCMD_SETVIEWPORT */
 
         if (cliprect) {
             SDL_Rect clip_rect;
diff --git a/src/test/SDL_test_memory.c b/src/test/SDL_test_memory.c
index 8f737ec12a8d..420762c004a0 100644
--- a/src/test/SDL_test_memory.c
+++ b/src/test/SDL_test_memory.c
@@ -171,7 +171,7 @@ static void *SDLCALL SDLTest_TrackedRealloc(void *ptr, size_t size)
 {
     void *mem;
 
-    SDL_assert(!ptr || SDL_IsAllocationTracked(ptr));
+    SDL_assert(ptr == NULL || SDL_IsAllocationTracked(ptr));
     mem = SDL_realloc_orig(ptr, size);
     if (mem && mem != ptr) {
         if (ptr) {
diff --git a/src/video/SDL_shape.c b/src/video/SDL_shape.c
index ecd683e78c8c..39ee2a835051 100644
--- a/src/video/SDL_shape.c
+++ b/src/video/SDL_shape.c
@@ -237,7 +237,7 @@ SDL_ShapeTree *SDL_CalculateShapeTree(SDL_WindowShapeMode mode, SDL_Surface *sha
 
 void SDL_TraverseShapeTree(SDL_ShapeTree *tree, SDL_TraversalFunction function, void *closure)
 {
-    SDL_assert(tree);
+    SDL_assert(tree != NULL);
     if (tree->kind == QuadShape) {
         SDL_TraverseShapeTree((SDL_ShapeTree *)tree->data.children.upleft, function, closure);
         SDL_TraverseShapeTree((SDL_ShapeTree *)tree->data.children.upright, function, closure);
diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c
index 44356baec916..26d254ffce04 100644
--- a/src/video/SDL_video.c
+++ b/src/video/SDL_video.c
@@ -267,7 +267,7 @@ static int SDL_CreateWindowTexture(SDL_VideoDevice *_this, SDL_Window *window, U
             }
         }
 
-        SDL_assert(renderer); /* should have explicitly checked this above. */
+        SDL_assert(renderer != NULL); /* should have explicitly checked this above. */
 
         /* Create the data after we successfully create the renderer (bug #1116) */
         data = (SDL_WindowTextureData *)SDL_calloc(1, sizeof(*data));
@@ -556,7 +556,7 @@ int SDL_VideoInit(const char *driver_name)
     return 0;
 
 pre_driver_error:
-    SDL_assert(!_this);
+    SDL_assert(_this == NULL);
     if (init_touch) {
         SDL_TouchQuit();
     }
@@ -2853,7 +2853,7 @@ int SDL_SetWindowGammaRamp(SDL_Window * window, const Uint16 * red,
         if (SDL_GetWindowGammaRamp(window, NULL, NULL, NULL) < 0) {
             return -1;
         }
-        SDL_assert(window->gamma);
+        SDL_assert(window->gamma != NULL);
     }
 
     if (red) {
diff --git a/src/video/directfb/SDL_DirectFB_shape.c b/src/video/directfb/SDL_DirectFB_shape.c
index f3b84831f4c8..9fd976bae019 100644
--- a/src/video/directfb/SDL_DirectFB_shape.c
+++ b/src/video/directfb/SDL_DirectFB_shape.c
@@ -61,7 +61,7 @@ SDL_WindowShaper *DirectFB_CreateShaper(SDL_Window* window)
 int DirectFB_ResizeWindowShape(SDL_Window* window)
 {
     SDL_ShapeData* data = window->shaper->driverdata;
-    SDL_assert(data);
+    SDL_assert(data != NULL);
 
     if (window->x != -1000)
     {
diff --git a/src/video/wayland/SDL_waylandmouse.c b/src/video/wayland/SDL_waylandmouse.c
index 2833c948bbe9..6e7e9d5a8856 100644
--- a/src/video/wayland/SDL_waylandmouse.c
+++ b/src/video/wayland/SDL_waylandmouse.c
@@ -357,7 +357,7 @@ static int create_buffer_from_shm(Wayland_CursorData *d,
         return SDL_SetError("mmap() failed.");
     }
 
-    SDL_assert(d->shm_data);
+    SDL_assert(d->shm_data != NULL);
 
     shm_pool = wl_shm_create_pool(data->shm, shm_fd, size);
     d->buffer = wl_shm_pool_create_buffer(shm_pool,
diff --git a/src/video/windows/SDL_windowsopengl.c b/src/video/windows/SDL_windowsopengl.c
index 538cfcfe06bd..851594835bd7 100644
--- a/src/video/windows/SDL_windowsopengl.c
+++ b/src/video/windows/SDL_windowsopengl.c
@@ -690,7 +690,7 @@ int WIN_GL_SetupWindow(_THIS, SDL_Window *window)
 
 SDL_bool WIN_GL_UseEGL(_THIS)
 {
-    SDL_assert(_this->gl_data);
+    SDL_assert(_this->gl_data != NULL);
     SDL_assert(_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_ES);
 
     return SDL_GetHintBoolean(SDL_HINT_OPENGL_ES_DRIVER, SDL_FALSE) || _this->gl_config.major_version == 1 || _this->gl_config.major_version > _this->gl_data->es_profile_max_supported_version.major || (_this->gl_config.major_version == _this->gl_data->es_profile_max_supported_version.major && _this->gl_config.minor_version > _this->gl_data->es_profile_max_supported_version.minor); /* No WGL extension for OpenGL ES 1.x profiles. */
@@ -829,7 +829,7 @@ int WIN_GL_MakeCurrent(_THIS, SDL_Window *window, SDL_GLContext context)
     }
 
     /* sanity check that higher level handled this. */
-    SDL_assert(window || (!window && !context));
+    SDL_assert(window || (window == NULL && !context));
 
     /* Some Windows drivers freak out if hdc is NULL, even when context is
        NULL, against spec. Since hdc is _supposed_ to be ignored if context
diff --git a/src/video/x11/SDL_x11events.c b/src/video/x11/SDL_x11events.c
index ec5433dfabf0..518c1ca3f134 100644
--- a/src/video/x11/SDL_x11events.c
+++ b/src/video/x11/SDL_x11events.c
@@ -803,7 +803,7 @@ static void X11_DispatchEvent(_THIS, XEvent *xevent)
     XClientMessageEvent m;
     int i;
 
-    SDL_assert(videodata);
+    SDL_assert(videodata != NULL);
     display = videodata->display;
 
     /* Save the original keycode for dead keys, which are filtered out by
diff --git a/src/video/x11/SDL_x11modes.c b/src/video/x11/SDL_x11modes.c
index ae4a4b24d4a4..25f2e43c57a1 100644
--- a/src/video/x11/SDL_x11modes.c
+++ b/src/video/x11/SDL_x11modes.c
@@ -410,7 +410,7 @@ static void X11_HandleXRandROutputChange(_THIS, const XRROutputChangeNotifyEvent
         }
     }
 
-    SDL_assert((displayidx == -1) == (!display));
+    SDL_assert((displayidx == -1) == (display == NULL));
 
     if (ev->connection == RR_Disconnected) { /* output is going away */
         if (display) {
diff --git a/src/video/x11/SDL_x11shape.c b/src/video/x11/SDL_x11shape.c
index 3d4dd493083c..9e7ce35aaf59 100644
--- a/src/video/x11/SDL_x11shape.c
+++ b/src/video/x11/SDL_x11shape.c
@@ -69,7 +69,7 @@ int X11_ResizeWindowShape(SDL_Window *window)
 {
     SDL_ShapeData *data = window->shaper->driverdata;
     unsigned int bitmapsize = window->w / 8;
-    SDL_assert(data);
+    SDL_assert(data != NULL);
 
     if (window->w % 8 > 0) {
         bitmapsize += 1;
diff --git a/src/video/x11/SDL_x11xfixes.c b/src/video/x11/SDL_x11xfixes.c
index 3c988bc3dde6..2189f231d57c 100644
--- a/src/video/x11/SDL_x11xfixes.c
+++ b/src/video/x11/SDL_x11xfixes.c
@@ -120,7 +120,7 @@ int X11_ConfineCursorWithFlags(_THIS, SDL_Window *window, const SDL_Rect *rect,
         X11_DestroyPointerBarrier(_this, data->active_cursor_confined_window);
     }
 
-    SDL_assert(window);
+    SDL_assert(window != NULL);
     wdata = (SDL_WindowData *)window->driverdata;
 
     /* If user did not specify an area to confine, destroy the barrier that was/is assigned to
diff --git a/src/video/x11/SDL_x11xinput2.c b/src/video/x11/SDL_x11xinput2.c
index 2abb0081780f..729269b0e926 100644
--- a/src/video/x11/SDL_x11xinput2.c
+++ b/src/video/x11/SDL_x11xinput2.c
@@ -190,7 +190,7 @@ static void xinput2_remove_device_info(SDL_VideoData *videodata, const int devic
 
     for (devinfo = videodata->mouse_device_info; devinfo; devinfo = devinfo->next) {
         if (devinfo->device_id == device_id) {
-            SDL_assert((devinfo == videodata->mouse_device_info) == (!prev));
+            SDL_assert((devinfo == videodata->mouse_device_info) == (prev == NULL));
             if (!prev) {
                 videodata->mouse_device_info = devinfo->next;
             } else {
@@ -214,7 +214,7 @@ static SDL_XInput2DeviceInfo *xinput2_get_device_info(SDL_VideoData *videodata,
 
     for (devinfo = videodata->mouse_device_info; devinfo; devinfo = devinfo->next) {
         if (devinfo->device_id == device_id) {
-            SDL_assert((devinfo == videodata->mouse_device_info) == (!prev));
+            SDL_assert((devinfo == videodata->mouse_device_info) == (prev == NULL));
             if (prev) { /* move this to the front of the list, assuming we'll get more from this one. */
                 prev->next = devinfo->next;
                 devinfo->next = videodata->mouse_device_info;
diff --git a/test/testautomation_surface.c b/test/testautomation_surface.c
index e241d8b0d664..41aa24142c0c 100644
--- a/test/testautomation_surface.c
+++ b/test/testautomation_surface.c
@@ -369,21 +369,21 @@ int surface_testCompleteSurfaceConversion(void *arg)
     for (i = 0; i < SDL_arraysize(pixel_formats); ++i) {
         for (j = 0; j < SDL_arraysize(pixel_formats); ++j) {
             fmt1 = SDL_AllocFormat(pixel_formats[i]);
-            SDL_assert(fmt1);
+            SDL_assert(fmt1 != NULL);
             cvt1 = SDL_ConvertSurface(face, fmt1, 0);
-            SDL_assert(cvt1);
+            SDL_assert(cvt1 != NULL);
 
             fmt2 = SDL_AllocFormat(pixel_formats[j]);
-            SDL_assert(fmt1);
+            SDL_assert(fmt1 != NULL);
             cvt2 = SDL_Conve

(Patch may be truncated, please check the link at the top of this post.)