SDL: Renamed AUDIODRIVER and VIDEODRIVER hint/env to AUDIO_DRIVER and VIDEO_DRIVER

From c265fb74b045fcaf6310f116c212d27c3e1104e9 Mon Sep 17 00:00:00 2001
From: Sylvain <[EMAIL REDACTED]>
Date: Thu, 8 Dec 2022 10:40:01 +0100
Subject: [PATCH] Renamed AUDIODRIVER and VIDEODRIVER hint/env to AUDIO_DRIVER
 and VIDEO_DRIVER

---
 WhatsNew.txt                    | 2 ++
 docs/README-migration.md        | 4 ++++
 include/SDL3/SDL_hints.h        | 4 ++--
 src/audio/SDL_audio.c           | 2 +-
 src/video/SDL_video.c           | 2 +-
 src/video/dummy/SDL_nullvideo.c | 2 +-
 test/CMakeLists.txt             | 4 ++--
 test/testaudiohotplug.c         | 2 +-
 test/testaudioinfo.c            | 2 +-
 9 files changed, 15 insertions(+), 9 deletions(-)

diff --git a/WhatsNew.txt b/WhatsNew.txt
index a67335330832..59762ecaa326 100644
--- a/WhatsNew.txt
+++ b/WhatsNew.txt
@@ -30,6 +30,8 @@ General:
     * SDL_HINT_VIDEO_X11_FORCE_EGL
     * SDL_HINT_VIDEO_X11_XINERAMA
     * SDL_HINT_VIDEO_X11_XVIDMODE
+* Renamed hints 'SDL_HINT_VIDEODRIVER' and 'SDL_HINT_AUDIODRIVER' to 'SDL_HINT_VIDEO_DRIVER' and 'SDL_HINT_AUDIO_DRIVER'
+* Renamed environment variables 'SDL_VIDEODRIVER' and 'SDL_AUDIODRIVER' to 'SDL_VIDEO_DRIVER' and 'SDL_AUDIO_DRIVER'
 * SDL_stdinc.h no longer includes stdio.h, stdlib.h, etc., it only provides the SDL C runtime functionality
 * Added SDL_CreateSurface() and SDL_CreateSurfaceFrom() which replace the SDL_CreateRGBSurface*(), and can also be used to create YUV surfaces
 * Removed unused 'flags' parameter from SDL_ConvertSurface and SDL_ConvertSurfaceFormat
diff --git a/docs/README-migration.md b/docs/README-migration.md
index 25ab3a25ab43..e5506cf4a276 100644
--- a/docs/README-migration.md
+++ b/docs/README-migration.md
@@ -308,3 +308,7 @@ The following hints have been removed:
 * SDL_HINT_VIDEO_X11_FORCE_EGL (use SDL_HINT_VIDEO_FORCE_EGL instead)
 * SDL_HINT_VIDEO_X11_XINERAMA (Xinerama no longer supported by the X11 backend)
 * SDL_HINT_VIDEO_X11_XVIDMODE (Xvidmode no longer supported by the X11 backend)
+
+* Renamed hints 'SDL_HINT_VIDEODRIVER' and 'SDL_HINT_AUDIODRIVER' to 'SDL_HINT_VIDEO_DRIVER' and 'SDL_HINT_AUDIO_DRIVER'
+* Renamed environment variables 'SDL_VIDEODRIVER' and 'SDL_AUDIODRIVER' to 'SDL_VIDEO_DRIVER' and 'SDL_AUDIO_DRIVER'
+
diff --git a/include/SDL3/SDL_hints.h b/include/SDL3/SDL_hints.h
index 39351bbd053a..6274a12194bc 100644
--- a/include/SDL3/SDL_hints.h
+++ b/include/SDL3/SDL_hints.h
@@ -2313,7 +2313,7 @@ extern "C" {
  *  This hint is available since SDL 2.0.22. Before then, you could set
  *  the environment variable to get the same effect.
  */
-#define SDL_HINT_VIDEODRIVER "SDL_VIDEODRIVER"
+#define SDL_HINT_VIDEO_DRIVER "SDL_VIDEO_DRIVER"
 
 /**
  *  \brief  A variable that decides what audio backend to use.
@@ -2336,7 +2336,7 @@ extern "C" {
  *  This hint is available since SDL 2.0.22. Before then, you could set
  *  the environment variable to get the same effect.
  */
-#define SDL_HINT_AUDIODRIVER "SDL_AUDIODRIVER"
+#define SDL_HINT_AUDIO_DRIVER "SDL_AUDIO_DRIVER"
 
 /**
  *  \brief  A variable that decides what KMSDRM device to use.
diff --git a/src/audio/SDL_audio.c b/src/audio/SDL_audio.c
index 275fd15ee367..2cc8fc5cef3e 100644
--- a/src/audio/SDL_audio.c
+++ b/src/audio/SDL_audio.c
@@ -892,7 +892,7 @@ int SDL_AudioInit(const char *driver_name)
 
     /* Select the proper audio driver */
     if (driver_name == NULL) {
-        driver_name = SDL_GetHint(SDL_HINT_AUDIODRIVER);
+        driver_name = SDL_GetHint(SDL_HINT_AUDIO_DRIVER);
     }
 
     if (driver_name != NULL && *driver_name != 0) {
diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c
index 18a7da5e1b93..905ab8640f15 100644
--- a/src/video/SDL_video.c
+++ b/src/video/SDL_video.c
@@ -443,7 +443,7 @@ int SDL_VideoInit(const char *driver_name)
     /* Select the proper video driver */
     video = NULL;
     if (driver_name == NULL) {
-        driver_name = SDL_GetHint(SDL_HINT_VIDEODRIVER);
+        driver_name = SDL_GetHint(SDL_HINT_VIDEO_DRIVER);
     }
     if (driver_name != NULL && *driver_name != 0) {
         const char *driver_attempt = driver_name;
diff --git a/src/video/dummy/SDL_nullvideo.c b/src/video/dummy/SDL_nullvideo.c
index f5b5bbaf3b76..04be2d35048f 100644
--- a/src/video/dummy/SDL_nullvideo.c
+++ b/src/video/dummy/SDL_nullvideo.c
@@ -62,7 +62,7 @@ static void DUMMY_EVDEV_Poll(_THIS);
 
 static int DUMMY_Available(void)
 {
-    const char *envr = SDL_GetHint(SDL_HINT_VIDEODRIVER);
+    const char *envr = SDL_GetHint(SDL_HINT_VIDEO_DRIVER);
     if (envr) {
         if (SDL_strcmp(envr, DUMMYVID_DRIVER_NAME) == 0) {
             return 1;
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 1cccd35280ef..2ed45b74ee6d 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -353,8 +353,8 @@ if(APPLE)
 endif()
 
 set(TESTS_ENVIRONMENT
-    SDL_AUDIODRIVER=dummy
-    SDL_VIDEODRIVER=dummy
+    SDL_AUDIO_DRIVER=dummy
+    SDL_VIDEO_DRIVER=dummy
 )
 
 foreach(TESTCASE ${SDL_TESTS_NONINTERACTIVE})
diff --git a/test/testaudiohotplug.c b/test/testaudiohotplug.c
index dd63cd8be429..cb7020b302a0 100644
--- a/test/testaudiohotplug.c
+++ b/test/testaudiohotplug.c
@@ -178,7 +178,7 @@ int main(int argc, char *argv[])
         SDL_Log("%i: %s", i, SDL_GetAudioDriver(i));
     }
 
-    SDL_Log("Select a driver with the SDL_AUDIODRIVER environment variable.\n");
+    SDL_Log("Select a driver with the SDL_AUDIO_DRIVER environment variable.\n");
     SDL_Log("Using audio driver: %s\n", SDL_GetCurrentAudioDriver());
 
 #ifdef __EMSCRIPTEN__
diff --git a/test/testaudioinfo.c b/test/testaudioinfo.c
index 4fca36f012be..2bdf92893569 100644
--- a/test/testaudioinfo.c
+++ b/test/testaudioinfo.c
@@ -69,7 +69,7 @@ int main(int argc, char **argv)
         for (i = 0; i < n; ++i) {
             SDL_Log("  %d: %s\n", i, SDL_GetAudioDriver(i));
         }
-        SDL_Log("Select a driver with the SDL_AUDIODRIVER environment variable.\n");
+        SDL_Log("Select a driver with the SDL_AUDIO_DRIVER environment variable.\n");
     }
 
     SDL_Log("Using audio driver: %s\n\n", SDL_GetCurrentAudioDriver());