From 809804e8e49e374e19943ffdf5b43057263428ee Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Sun, 15 Sep 2024 10:09:53 -0700
Subject: [PATCH] Revert "update for new thread-safe environment functions in
SDL3"
This reverts commit 3d8376d9a869a340bffa5d29f6a1a4d656f68d70.
SDL_getenv() is back!
---
examples/playmus.c | 2 +-
src/codecs/music_timidity.c | 2 +-
src/effects_internal.c | 2 +-
src/music.c | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/examples/playmus.c b/examples/playmus.c
index 4812b994..97a67b40 100644
--- a/examples/playmus.c
+++ b/examples/playmus.c
@@ -205,7 +205,7 @@ int main(int argc, char *argv[])
Mix_VolumeMusic(audio_volume);
/* Set the external music player, if any */
- Mix_SetMusicCMD(SDL_GetEnvironmentVariable(SDL_GetEnvironment(), "MUSIC_CMD"));
+ Mix_SetMusicCMD(SDL_getenv("MUSIC_CMD"));
while (argv[i]) {
next_track = 0;
diff --git a/src/codecs/music_timidity.c b/src/codecs/music_timidity.c
index cdbc8a03..726a7f91 100644
--- a/src/codecs/music_timidity.c
+++ b/src/codecs/music_timidity.c
@@ -59,7 +59,7 @@ static int TIMIDITY_Open(const SDL_AudioSpec *spec)
(void) spec;
- cfg = SDL_GetEnvironmentVariable(SDL_GetEnvironment(), "TIMIDITY_CFG");
+ cfg = SDL_getenv("TIMIDITY_CFG");
if(!cfg) cfg = Mix_GetTimidityCfg();
if (cfg) {
return Timidity_Init(cfg); /* env or user override: no other tries */
diff --git a/src/effects_internal.c b/src/effects_internal.c
index f1108672..a1d81f77 100644
--- a/src/effects_internal.c
+++ b/src/effects_internal.c
@@ -37,7 +37,7 @@ int _Mix_effects_max_speed = 0;
void _Mix_InitEffects(void)
{
- _Mix_effects_max_speed = (SDL_GetEnvironmentVariable(SDL_GetEnvironment(), MIX_EFFECTSMAXSPEED) != NULL);
+ _Mix_effects_max_speed = (SDL_getenv(MIX_EFFECTSMAXSPEED) != NULL);
}
void _Mix_DeinitEffects(void)
diff --git a/src/music.c b/src/music.c
index 1efd3812..ed42ea02 100644
--- a/src/music.c
+++ b/src/music.c
@@ -1495,7 +1495,7 @@ SDL_bool Mix_SetSoundFonts(const char *paths)
const char* Mix_GetSoundFonts(void)
{
- const char *env_paths = SDL_GetEnvironmentVariable(SDL_GetEnvironment(), "SDL_SOUNDFONTS");
+ const char *env_paths = SDL_getenv("SDL_SOUNDFONTS");
SDL_bool force_env_paths = SDL_GetHintBoolean("SDL_FORCE_SOUNDFONTS", SDL_FALSE);
if (force_env_paths && (!env_paths || !*env_paths)) {
force_env_paths = SDL_FALSE;