Added thread-safe environment functions

Also marked the existing functions as unsafe, as they can cause crashes if used in multi-threaded applications.

As a bonus, since the new functions are hashtable based, hint environment lookups are much faster.
This commit is contained in:
Sam Lantinga
2024-09-13 17:00:15 -07:00
parent 16ff7503b7
commit 90e01040c5
49 changed files with 696 additions and 252 deletions

View File

@@ -229,12 +229,12 @@ static void run_zenity(zenityArgs* arg_struct)
/* Recent versions of Zenity have different exit codes, but picks up
different codes from the environment */
SDL_setenv("ZENITY_OK", "0", 1);
SDL_setenv("ZENITY_CANCEL", "1", 1);
SDL_setenv("ZENITY_ESC", "1", 1);
SDL_setenv("ZENITY_EXTRA", "2", 1);
SDL_setenv("ZENITY_ERROR", "2", 1);
SDL_setenv("ZENITY_TIMEOUT", "2", 1);
SDL_setenv_unsafe("ZENITY_OK", "0", 1);
SDL_setenv_unsafe("ZENITY_CANCEL", "1", 1);
SDL_setenv_unsafe("ZENITY_ESC", "1", 1);
SDL_setenv_unsafe("ZENITY_EXTRA", "2", 1);
SDL_setenv_unsafe("ZENITY_ERROR", "2", 1);
SDL_setenv_unsafe("ZENITY_TIMEOUT", "2", 1);
execv(args[0], args);