From 3d8376d9a869a340bffa5d29f6a1a4d656f68d70 Mon Sep 17 00:00:00 2001
From: Ozkan Sezer <[EMAIL REDACTED]>
Date: Sun, 15 Sep 2024 01:56:40 +0300
Subject: [PATCH] update for new thread-safe environment functions in SDL3
Closes: https://github.com/libsdl-org/SDL_mixer/pull/633
---
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 97a67b40..4812b994 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_getenv("MUSIC_CMD"));
+ Mix_SetMusicCMD(SDL_GetEnvironmentVariable(SDL_GetEnvironment(), "MUSIC_CMD"));
while (argv[i]) {
next_track = 0;
diff --git a/src/codecs/music_timidity.c b/src/codecs/music_timidity.c
index 726a7f91..cdbc8a03 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_getenv("TIMIDITY_CFG");
+ cfg = SDL_GetEnvironmentVariable(SDL_GetEnvironment(), "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 a1d81f77..f1108672 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_getenv(MIX_EFFECTSMAXSPEED) != NULL);
+ _Mix_effects_max_speed = (SDL_GetEnvironmentVariable(SDL_GetEnvironment(), MIX_EFFECTSMAXSPEED) != NULL);
}
void _Mix_DeinitEffects(void)
diff --git a/src/music.c b/src/music.c
index ed42ea02..1efd3812 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_getenv("SDL_SOUNDFONTS");
+ const char *env_paths = SDL_GetEnvironmentVariable(SDL_GetEnvironment(), "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;