SDL: Use functions from SDL instead of libc

From f85535b4b607d05b369355a3c7b1c1022250687b Mon Sep 17 00:00:00 2001
From: meyraud705 <[EMAIL REDACTED]>
Date: Mon, 5 Feb 2024 13:54:05 +0100
Subject: [PATCH] Use functions from SDL instead of libc

---
 src/video/SDL_pixels.c     | 6 +++---
 src/video/x11/SDL_x11pen.c | 2 +-
 test/testpen.c             | 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/video/SDL_pixels.c b/src/video/SDL_pixels.c
index 8ee806b5825f..e050f1ded6b7 100644
--- a/src/video/SDL_pixels.c
+++ b/src/video/SDL_pixels.c
@@ -759,9 +759,9 @@ float SDL_PQfromNits(float v)
     const float m2 = 78.84375f;
 
     float y = SDL_clamp(v / 10000.0f, 0.0f, 1.0f);
-    float num = c1 + c2 * pow(y, m1);
-    float den = 1.0f + c3 * pow(y, m1);
-    return pow(num / den, m2);
+    float num = c1 + c2 * SDL_powf(y, m1);
+    float den = 1.0f + c3 * SDL_powf(y, m1);
+    return SDL_powf(num / den, m2);
 }
 
 const float *SDL_GetYCbCRtoRGBConversionMatrix(SDL_Colorspace colorspace)
diff --git a/src/video/x11/SDL_x11pen.c b/src/video/x11/SDL_x11pen.c
index 61ad579a33e2..8886d6a66bd6 100644
--- a/src/video/x11/SDL_x11pen.c
+++ b/src/video/x11/SDL_x11pen.c
@@ -275,7 +275,7 @@ static SDL_bool xinput2_pen_is_eraser(SDL_VideoDevice *_this, int deviceid, char
     SDL_strlcpy(dev_name, devicename, PEN_ERASER_ID_MAXLEN);
     /* lowercase device name string so we can use strstr() */
     for (k = 0; dev_name[k]; ++k) {
-        dev_name[k] = tolower(dev_name[k]);
+        dev_name[k] = SDL_tolower(dev_name[k]);
     }
 
     return (SDL_strstr(dev_name, PEN_ERASER_NAME_TAG)) ? SDL_TRUE : SDL_FALSE;
diff --git a/test/testpen.c b/test/testpen.c
index 044bbe1640dd..be96c20f0af0 100644
--- a/test/testpen.c
+++ b/test/testpen.c
@@ -158,7 +158,7 @@ static void DrawScreen(SDL_Renderer *renderer)
     SDL_RenderLine(renderer, X, Y, endx - (ydelta * last_pressure / 3.0f), endy + (xdelta * last_pressure / 3.0f));
 
     /* If tilt is very small (or zero, for pens that don't have tilt), add some extra lines, rotated by the current rotation value */
-    if (ALWAYS_SHOW_PRESSURE_BOX || (fabs(tilt_vec_x) < 0.2f && fabs(tilt_vec_y) < 0.2f)) {
+    if (ALWAYS_SHOW_PRESSURE_BOX || (SDL_fabs(tilt_vec_x) < 0.2f && SDL_fabs(tilt_vec_y) < 0.2f)) {
         int rot;
         float pressure = last_pressure * 80.0f;