mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-04-24 08:15:50 +00:00
SDL_getenv() should return const
This also allows us to use SDL_FreeLater() and make SDL_getenv() thread-safe on Windows.
This commit is contained in:
@@ -461,15 +461,16 @@ extern SDL_NORETURN void SDL_ExitProcess(int exitcode);
|
||||
|
||||
static void SDL_InitDynamicAPILocked(void)
|
||||
{
|
||||
char *libname = SDL_getenv_REAL(SDL_DYNAMIC_API_ENVVAR);
|
||||
const char *libname = SDL_getenv_REAL(SDL_DYNAMIC_API_ENVVAR);
|
||||
SDL_DYNAPI_ENTRYFN entry = NULL; /* funcs from here by default. */
|
||||
SDL_bool use_internal = SDL_TRUE;
|
||||
|
||||
if (libname) {
|
||||
while (*libname && !entry) {
|
||||
char *ptr = libname;
|
||||
// This is evil, but we're not making any permanent changes...
|
||||
char *ptr = (char *)libname;
|
||||
while (SDL_TRUE) {
|
||||
const char ch = *ptr;
|
||||
char ch = *ptr;
|
||||
if ((ch == ',') || (ch == '\0')) {
|
||||
*ptr = '\0';
|
||||
entry = (SDL_DYNAPI_ENTRYFN)get_sdlapi_entry(libname, "SDL_DYNAPI_entry");
|
||||
|
||||
@@ -955,7 +955,7 @@ SDL_DYNAPI_PROC(float,SDL_floorf,(float a),(a),return)
|
||||
SDL_DYNAPI_PROC(double,SDL_fmod,(double a, double b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(float,SDL_fmodf,(float a, float b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(void,SDL_free,(void *a),(a),)
|
||||
SDL_DYNAPI_PROC(char*,SDL_getenv,(const char *a),(a),return)
|
||||
SDL_DYNAPI_PROC(const char*,SDL_getenv,(const char *a),(a),return)
|
||||
SDL_DYNAPI_PROC(void,SDL_hid_ble_scan,(SDL_bool a),(a),)
|
||||
SDL_DYNAPI_PROC(int,SDL_hid_close,(SDL_hid_device *a),(a),return)
|
||||
SDL_DYNAPI_PROC(Uint32,SDL_hid_device_change_count,(void),(),return)
|
||||
|
||||
Reference in New Issue
Block a user