foxygit / doom Log in
commit 258ef0701e3a2119026a3afc99dd810f6aedc241
Author:     Turo Lamminen <turol@iki.fi>
AuthorDate: Sat Aug 28 17:01:59 2021 +0300
Commit:     Turo Lamminen <turol@iki.fi>
CommitDate: Sat Aug 28 17:01:59 2021 +0300

    music: Fix const correctness issue in I_InitTimidityConfig
---
 src/i_sdlmusic.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/i_sdlmusic.c b/src/i_sdlmusic.c
index 8c492f54..44baa836 100644
--- a/src/i_sdlmusic.c
+++ b/src/i_sdlmusic.c
@@ -93,6 +93,12 @@ static boolean WriteWrapperTimidityConfig(char *write_path)
     return true;
 }

+
+// putenv requires a non-const string whose lifetime is the whole program
+// so can't use a string directly, have to do this silliness
+static char sdl_mixer_disable_fluidsynth[] = "SDL_MIXER_DISABLE_FLUIDSYNTH=1";
+
+
 void I_InitTimidityConfig(void)
 {
     char *env_string;
@@ -121,7 +127,7 @@ void I_InitTimidityConfig(void)
         // timidity_cfg_path or GUS mode), then disable Fluidsynth, because
         // SDL_mixer considers Fluidsynth a higher priority than Timidity and
         // therefore can end up circumventing Timidity entirely.
-        putenv("SDL_MIXER_DISABLE_FLUIDSYNTH=1");
+        putenv(sdl_mixer_disable_fluidsynth);
     }
     else
     {