From 123a66fc4362a91da63f6b08252ea3f9ca01c61d Mon Sep 17 00:00:00 2001 From: Yonggang Luo Date: Thu, 6 Nov 2025 14:18:15 +0800 Subject: [PATCH] util,asahi,vulkan,panfrost: Replace the remaining usage of getenv with os_get_option Signed-off-by: Yonggang Luo Reviewed-by: Antonio Ospite Part-of: --- src/asahi/lib/decode.c | 2 +- src/panfrost/genxml/decode_common.c | 2 +- src/util/disk_cache_os.c | 2 +- src/util/u_debug.h | 2 +- src/util/xmlconfig.c | 4 ++-- src/vulkan/device-select-layer/device_select_layer.c | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/asahi/lib/decode.c b/src/asahi/lib/decode.c index 66014b9f76c..a7cb8413e48 100644 --- a/src/asahi/lib/decode.c +++ b/src/asahi/lib/decode.c @@ -1021,7 +1021,7 @@ agxdecode_dump_file_open(void) if (agxdecode_dump_stream) return; - /* This does a getenv every frame, so it is possible to use + /* This does a os_get_option every frame, so it is possible to use * setenv to change the base at runtime. */ const char *dump_file_base = diff --git a/src/panfrost/genxml/decode_common.c b/src/panfrost/genxml/decode_common.c index b579a2f3729..52c0b7ed96e 100644 --- a/src/panfrost/genxml/decode_common.c +++ b/src/panfrost/genxml/decode_common.c @@ -251,7 +251,7 @@ pandecode_dump_file_open(struct pandecode_context *ctx) { simple_mtx_assert_locked(&ctx->lock); - /* This does a getenv every frame, so it is possible to use + /* This does a os_get_option every frame, so it is possible to use * setenv to change the base at runtime. */ const char *dump_file_base = diff --git a/src/util/disk_cache_os.c b/src/util/disk_cache_os.c index 18d8068ee3c..398bda97250 100644 --- a/src/util/disk_cache_os.c +++ b/src/util/disk_cache_os.c @@ -938,7 +938,7 @@ disk_cache_generate_cache_dir(void *mem_ctx, const char *gpu_name, } if (!path) { - char *home = getenv("HOME"); + const char *home = os_get_option("HOME"); if (home) { path = concatenate_and_mkdir(mem_ctx, home, ".cache", mkdir); diff --git a/src/util/u_debug.h b/src/util/u_debug.h index 11eea0a8c1d..9608e97ba65 100644 --- a/src/util/u_debug.h +++ b/src/util/u_debug.h @@ -353,7 +353,7 @@ comma_separated_list_contains(const char *list, const char *s); /** * Get option. * - * It is an alias for getenv on Unix and Windows. + * It is an alias for os_get_option. * */ const char * diff --git a/src/util/xmlconfig.c b/src/util/xmlconfig.c index 21cf1294dc9..63190788c3f 100644 --- a/src/util/xmlconfig.c +++ b/src/util/xmlconfig.c @@ -1257,7 +1257,7 @@ driParseConfigFiles(driOptionCache *cache, const driOptionCache *info, #if WITH_XMLCONFIG const char *configdir; - char *home; + const char *home; /* parse from either $DRIRC_CONFIGDIR or $datadir/drirc.d */ if ((configdir = os_get_option("DRIRC_CONFIGDIR"))) @@ -1267,7 +1267,7 @@ driParseConfigFiles(driOptionCache *cache, const driOptionCache *info, parseOneConfigFile(&userData, SYSCONFDIR "/drirc"); } - if ((home = getenv("HOME"))) { + if ((home = os_get_option("HOME"))) { char filename[PATH_MAX]; snprintf(filename, PATH_MAX, "%s/.drirc", home); diff --git a/src/vulkan/device-select-layer/device_select_layer.c b/src/vulkan/device-select-layer/device_select_layer.c index 35c2dc726dc..ba3b2ee9465 100644 --- a/src/vulkan/device-select-layer/device_select_layer.c +++ b/src/vulkan/device-select-layer/device_select_layer.c @@ -131,7 +131,7 @@ device_select_CreateInstance(const VkInstanceCreateInfo *pCreateInfo, bool has_wayland = os_get_option("WAYLAND_DISPLAY") || os_get_option("WAYLAND_SOCKET"); #endif #ifdef VK_USE_PLATFORM_XCB_KHR - bool has_xcb = !!getenv("DISPLAY"); + bool has_xcb = !!os_get_option("DISPLAY"); #endif for (unsigned i = 0; i < pCreateInfo->enabledExtensionCount; i++) {