From 6f04db82f3ef93b89335258f08e1bd6bda2aee5f Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Sun, 15 Sep 2024 10:07:44 -0700
Subject: [PATCH] Revert "update for new thread-safe environment functions in
SDL3"
This reverts commit 94ed961dfca360867397a319f80ca0c82157b708.
SDL_getenv() is back!
---
test/main.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/test/main.c b/test/main.c
index ea863b03..59790f42 100644
--- a/test/main.c
+++ b/test/main.c
@@ -68,9 +68,9 @@ GetTestFilename(TestFileType type, const char *file)
SDL_bool needPathSep = SDL_TRUE;
if (type == TEST_FILE_DIST) {
- base = SDL_GetEnvironmentVariable(SDL_GetEnvironment(), "SDL_TEST_SRCDIR");
+ base = SDL_getenv("SDL_TEST_SRCDIR");
} else {
- base = SDL_GetEnvironmentVariable(SDL_GetEnvironment(), "SDL_TEST_BUILDDIR");
+ base = SDL_getenv("SDL_TEST_BUILDDIR");
}
if (base == NULL) {
@@ -750,7 +750,7 @@ FormatLoadTest(const Format *format,
"Expected height %d px, got %d",
format->h, surface->h);
- if (GetStringBoolean(SDL_GetEnvironmentVariable(SDL_GetEnvironment(), "SDL_IMAGE_TEST_DEBUG"), SDL_FALSE)) {
+ if (GetStringBoolean(SDL_getenv("SDL_IMAGE_TEST_DEBUG"), SDL_FALSE)) {
DumpPixels(filename, surface);
}
@@ -761,7 +761,7 @@ FormatLoadTest(const Format *format,
SDLTest_AssertCheck(diff == 0,
"Surface differed from reference by at most %d in %d pixels",
format->tolerance, diff);
- if (diff != 0 || GetStringBoolean(SDL_GetEnvironmentVariable(SDL_GetEnvironment(), "SDL_IMAGE_TEST_DEBUG"), SDL_FALSE)) {
+ if (diff != 0 || GetStringBoolean(SDL_getenv("SDL_IMAGE_TEST_DEBUG"), SDL_FALSE)) {
DumpPixels(filename, surface);
DumpPixels(refFilename, reference);
}
@@ -890,7 +890,7 @@ FormatSaveTest(const Format *format,
SDLTest_AssertCheck(diff == 0,
"Surface differed from reference by at most %d in %d pixels",
format->tolerance, diff);
- if (diff != 0 || GetStringBoolean(SDL_GetEnvironmentVariable(SDL_GetEnvironment(), "SDL_IMAGE_TEST_DEBUG"), SDL_FALSE)) {
+ if (diff != 0 || GetStringBoolean(SDL_getenv("SDL_IMAGE_TEST_DEBUG"), SDL_FALSE)) {
DumpPixels(filename, surface);
DumpPixels(refFilename, reference);
}
@@ -920,7 +920,7 @@ FormatTest(const Format *format)
SDL_snprintf(envVar, sizeof(envVar), "SDL_IMAGE_TEST_REQUIRE_LOAD_%s",
format->name);
- forced = GetStringBoolean(SDL_GetEnvironmentVariable(SDL_GetEnvironment(), envVar), SDL_FALSE);
+ forced = GetStringBoolean(SDL_getenv(envVar), SDL_FALSE);
if (forced) {
SDLTest_AssertCheck(format->canLoad,
"%s loading should be enabled", format->name);
@@ -953,7 +953,7 @@ FormatTest(const Format *format)
SDL_snprintf(envVar, sizeof(envVar), "SDL_IMAGE_TEST_REQUIRE_SAVE_%s",
format->name);
- forced = GetStringBoolean(SDL_GetEnvironmentVariable(SDL_GetEnvironment(), envVar), SDL_FALSE);
+ forced = GetStringBoolean(SDL_getenv(envVar), SDL_FALSE);
if (forced) {
SDLTest_AssertCheck(format->canSave,
"%s saving should be enabled", format->name);