SDL: Removed SDL_GetErrorMsg(), trivially implemented in application code

From ecd56bb8f00782dc521712e70ad3340629f18694 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Fri, 1 Dec 2023 09:08:23 -0800
Subject: [PATCH] Removed SDL_GetErrorMsg(), trivially implemented in
 application code

---
 docs/README-migration.md          |  5 +++++
 include/SDL3/SDL_error.h          | 17 -----------------
 src/SDL_error.c                   |  6 ------
 src/dynapi/SDL_dynapi.sym         |  1 -
 src/dynapi/SDL_dynapi_overrides.h |  1 -
 src/dynapi/SDL_dynapi_procs.h     |  1 -
 6 files changed, 5 insertions(+), 26 deletions(-)

diff --git a/docs/README-migration.md b/docs/README-migration.md
index 4c084b04f423..e6f434701d9f 100644
--- a/docs/README-migration.md
+++ b/docs/README-migration.md
@@ -290,6 +290,11 @@ SDL_HasRDTSC() has been removed; there is no replacement. Don't use the RDTSC op
 
 SDL_SIMDAlloc(), SDL_SIMDRealloc(), and SDL_SIMDFree() have been removed. You can use SDL_aligned_alloc() and SDL_aligned_free() with SDL_SIMDGetAlignment() to get the same functionality.
 
+## SDL_error.h
+
+The following functions have been removed:
+* SDL_GetErrorMsg() - Can be implemented as `SDL_strlcpy(errstr, SDL_GetError(), maxlen);`
+
 ## SDL_events.h
 
 The timestamp member of the SDL_Event structure now represents nanoseconds, and is populated with SDL_GetTicksNS()
diff --git a/include/SDL3/SDL_error.h b/include/SDL3/SDL_error.h
index 9440f4277432..26b7d33d7f96 100644
--- a/include/SDL3/SDL_error.h
+++ b/include/SDL3/SDL_error.h
@@ -102,23 +102,6 @@ extern DECLSPEC int SDLCALL SDL_SetError(SDL_PRINTF_FORMAT_STRING const char *fm
  */
 extern DECLSPEC const char *SDLCALL SDL_GetError(void);
 
-/**
- * Get the last error message that was set for the current thread.
- *
- * This allows the caller to copy the error string into a provided buffer, but
- * otherwise operates exactly the same as SDL_GetError().
- *
- * \param errstr A buffer to fill with the last error message that was set for
- *               the current thread
- * \param maxlen The size of the buffer pointed to by the errstr parameter
- * \returns the pointer passed in as the `errstr` parameter.
- *
- * \since This function is available since SDL 3.0.0.
- *
- * \sa SDL_GetError
- */
-extern DECLSPEC char * SDLCALL SDL_GetErrorMsg(char *errstr, int maxlen);
-
 /**
  * Clear any previous error message for this thread.
  *
diff --git a/src/SDL_error.c b/src/SDL_error.c
index b0db7aa10c08..e7773ca49230 100644
--- a/src/SDL_error.c
+++ b/src/SDL_error.c
@@ -98,9 +98,3 @@ int SDL_Error(SDL_errorcode code)
         return SDL_SetError("Unknown SDL error");
     }
 }
-
-char *SDL_GetErrorMsg(char *errstr, int maxlen)
-{
-    SDL_strlcpy(errstr, SDL_GetError(), maxlen);
-    return errstr;
-}
diff --git a/src/dynapi/SDL_dynapi.sym b/src/dynapi/SDL_dynapi.sym
index 8d1bd4811ae3..e007e8d4a3a4 100644
--- a/src/dynapi/SDL_dynapi.sym
+++ b/src/dynapi/SDL_dynapi.sym
@@ -164,7 +164,6 @@ SDL3_0.0.0 {
     SDL_GetDisplayUsableBounds;
     SDL_GetDisplays;
     SDL_GetError;
-    SDL_GetErrorMsg;
     SDL_GetEventFilter;
     SDL_GetFullscreenDisplayModes;
     SDL_GetGamepadAppleSFSymbolsNameForAxis;
diff --git a/src/dynapi/SDL_dynapi_overrides.h b/src/dynapi/SDL_dynapi_overrides.h
index 3be07fa25529..9c9696d445ad 100644
--- a/src/dynapi/SDL_dynapi_overrides.h
+++ b/src/dynapi/SDL_dynapi_overrides.h
@@ -188,7 +188,6 @@
 #define SDL_GetDisplayUsableBounds SDL_GetDisplayUsableBounds_REAL
 #define SDL_GetDisplays SDL_GetDisplays_REAL
 #define SDL_GetError SDL_GetError_REAL
-#define SDL_GetErrorMsg SDL_GetErrorMsg_REAL
 #define SDL_GetEventFilter SDL_GetEventFilter_REAL
 #define SDL_GetFullscreenDisplayModes SDL_GetFullscreenDisplayModes_REAL
 #define SDL_GetGamepadAppleSFSymbolsNameForAxis SDL_GetGamepadAppleSFSymbolsNameForAxis_REAL
diff --git a/src/dynapi/SDL_dynapi_procs.h b/src/dynapi/SDL_dynapi_procs.h
index 0ae19f03064c..e055c8d06fe8 100644
--- a/src/dynapi/SDL_dynapi_procs.h
+++ b/src/dynapi/SDL_dynapi_procs.h
@@ -247,7 +247,6 @@ SDL_DYNAPI_PROC(const char*,SDL_GetDisplayName,(SDL_DisplayID a),(a),return)
 SDL_DYNAPI_PROC(int,SDL_GetDisplayUsableBounds,(SDL_DisplayID a, SDL_Rect *b),(a,b),return)
 SDL_DYNAPI_PROC(SDL_DisplayID*,SDL_GetDisplays,(int *a),(a),return)
 SDL_DYNAPI_PROC(const char*,SDL_GetError,(void),(),return)
-SDL_DYNAPI_PROC(char*,SDL_GetErrorMsg,(char *a, int b),(a,b),return)
 SDL_DYNAPI_PROC(SDL_bool,SDL_GetEventFilter,(SDL_EventFilter *a, void **b),(a,b),return)
 SDL_DYNAPI_PROC(const SDL_DisplayMode**,SDL_GetFullscreenDisplayModes,(SDL_DisplayID a, int *b),(a,b),return)
 SDL_DYNAPI_PROC(const char*,SDL_GetGamepadAppleSFSymbolsNameForAxis,(SDL_Gamepad *a, SDL_GamepadAxis b),(a,b),return)