sdl12-compat: tweak SDL12COMPAT_strlen() / volatile hack to be c++-23 compatible.

From 04ba42c412991558a39a3bd7651b20f756c380c5 Mon Sep 17 00:00:00 2001
From: Ozkan Sezer <[EMAIL REDACTED]>
Date: Sat, 13 Jun 2026 08:33:20 +0300
Subject: [PATCH] tweak SDL12COMPAT_strlen() / volatile hack to be c++-23
 compatible.

Reference issue: https://github.com/libsdl-org/sdl2-compat/issues/340.
---
 src/SDL12_compat.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/SDL12_compat.c b/src/SDL12_compat.c
index 9da6f3318..d0da6dbbb 100644
--- a/src/SDL12_compat.c
+++ b/src/SDL12_compat.c
@@ -1158,11 +1158,11 @@ SDL12COMPAT_itoa(char *dst, int val)
 /* you can use SDL20_strlen once we're past startup. */
 static int SDL12COMPAT_strlen(const char *str)
 {
-    volatile int retval = 0;  /* volatile prevents gcc from optimizing this into strlen() */
-    while (str[retval]) {
-        retval++;
+    volatile const char *ptr = str;
+    while (*ptr) {
+        ++ptr;
     }
-    return retval;
+    return (int)(ptr - str);
 }
 
 /* you can use SDL20_strcmp once we're past startup. */