SDL: Don't assert on API parameters

From 6c4b4ee7a64bdfdcbe2a9fa34b7abeb5882bb23c Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Wed, 10 Nov 2021 09:41:43 -0800
Subject: [PATCH] Don't assert on API parameters

This causes lots of spam in test automation and it's not clear it's useful to developers. If we need this level of validation, we should add a log category for it.
---
 src/hidapi/SDL_hidapi.c | 1 -
 src/render/SDL_render.c | 2 --
 src/video/SDL_video.c   | 3 ---
 3 files changed, 6 deletions(-)

diff --git a/src/hidapi/SDL_hidapi.c b/src/hidapi/SDL_hidapi.c
index f1d607f7d6..dbb0ae8d64 100644
--- a/src/hidapi/SDL_hidapi.c
+++ b/src/hidapi/SDL_hidapi.c
@@ -462,7 +462,6 @@ DeleteHIDDeviceWrapper(SDL_hid_device *device)
 }
 
 #define CHECK_DEVICE_MAGIC(device, retval) \
-    SDL_assert(device && device->magic == &device_magic); \
     if (!device || device->magic != &device_magic) { \
         SDL_SetError("Invalid device"); \
         return retval; \
diff --git a/src/render/SDL_render.c b/src/render/SDL_render.c
index 5bca652fd5..5c037c443c 100644
--- a/src/render/SDL_render.c
+++ b/src/render/SDL_render.c
@@ -47,14 +47,12 @@ this should probably be removed at some point in the future.  --ryan. */
 #define SDL_WINDOWRENDERDATA    "_SDL_WindowRenderData"
 
 #define CHECK_RENDERER_MAGIC(renderer, retval) \
-    SDL_assert(renderer && renderer->magic == &renderer_magic); \
     if (!renderer || renderer->magic != &renderer_magic) { \
         SDL_SetError("Invalid renderer"); \
         return retval; \
     }
 
 #define CHECK_TEXTURE_MAGIC(texture, retval) \
-    SDL_assert(texture && texture->magic == &texture_magic); \
     if (!texture || texture->magic != &texture_magic) { \
         SDL_SetError("Invalid texture"); \
         return retval; \
diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c
index 276c0674bb..af9302be4f 100644
--- a/src/video/SDL_video.c
+++ b/src/video/SDL_video.c
@@ -135,7 +135,6 @@ static SDL_VideoDevice *_this = NULL;
         SDL_UninitializedVideo(); \
         return retval; \
     } \
-    SDL_assert(window && window->magic == &_this->window_magic); \
     if (!window || window->magic != &_this->window_magic) { \
         SDL_SetError("Invalid window"); \
         return retval; \
@@ -146,8 +145,6 @@ static SDL_VideoDevice *_this = NULL;
         SDL_UninitializedVideo(); \
         return retval; \
     } \
-    SDL_assert(_this->displays != NULL); \
-    SDL_assert(displayIndex >= 0 && displayIndex < _this->num_displays); \
     if (displayIndex < 0 || displayIndex >= _this->num_displays) { \
         SDL_SetError("displayIndex must be in the range 0 - %d", \
                      _this->num_displays - 1); \