util,asahi,vulkan,panfrost: Replace the remaining usage of getenv with os_get_option

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Antonio Ospite <antonio.ospite@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38640>
This commit is contained in:
Yonggang Luo 2025-11-06 14:18:15 +08:00 committed by Marge Bot
parent 95938823f4
commit 123a66fc43
6 changed files with 7 additions and 7 deletions

View file

@ -1021,7 +1021,7 @@ agxdecode_dump_file_open(void)
if (agxdecode_dump_stream) if (agxdecode_dump_stream)
return; 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. * setenv to change the base at runtime.
*/ */
const char *dump_file_base = const char *dump_file_base =

View file

@ -251,7 +251,7 @@ pandecode_dump_file_open(struct pandecode_context *ctx)
{ {
simple_mtx_assert_locked(&ctx->lock); 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. * setenv to change the base at runtime.
*/ */
const char *dump_file_base = const char *dump_file_base =

View file

@ -938,7 +938,7 @@ disk_cache_generate_cache_dir(void *mem_ctx, const char *gpu_name,
} }
if (!path) { if (!path) {
char *home = getenv("HOME"); const char *home = os_get_option("HOME");
if (home) { if (home) {
path = concatenate_and_mkdir(mem_ctx, home, ".cache", mkdir); path = concatenate_and_mkdir(mem_ctx, home, ".cache", mkdir);

View file

@ -353,7 +353,7 @@ comma_separated_list_contains(const char *list, const char *s);
/** /**
* Get option. * Get option.
* *
* It is an alias for getenv on Unix and Windows. * It is an alias for os_get_option.
* *
*/ */
const char * const char *

View file

@ -1257,7 +1257,7 @@ driParseConfigFiles(driOptionCache *cache, const driOptionCache *info,
#if WITH_XMLCONFIG #if WITH_XMLCONFIG
const char *configdir; const char *configdir;
char *home; const char *home;
/* parse from either $DRIRC_CONFIGDIR or $datadir/drirc.d */ /* parse from either $DRIRC_CONFIGDIR or $datadir/drirc.d */
if ((configdir = os_get_option("DRIRC_CONFIGDIR"))) if ((configdir = os_get_option("DRIRC_CONFIGDIR")))
@ -1267,7 +1267,7 @@ driParseConfigFiles(driOptionCache *cache, const driOptionCache *info,
parseOneConfigFile(&userData, SYSCONFDIR "/drirc"); parseOneConfigFile(&userData, SYSCONFDIR "/drirc");
} }
if ((home = getenv("HOME"))) { if ((home = os_get_option("HOME"))) {
char filename[PATH_MAX]; char filename[PATH_MAX];
snprintf(filename, PATH_MAX, "%s/.drirc", home); snprintf(filename, PATH_MAX, "%s/.drirc", home);

View file

@ -131,7 +131,7 @@ device_select_CreateInstance(const VkInstanceCreateInfo *pCreateInfo,
bool has_wayland = os_get_option("WAYLAND_DISPLAY") || os_get_option("WAYLAND_SOCKET"); bool has_wayland = os_get_option("WAYLAND_DISPLAY") || os_get_option("WAYLAND_SOCKET");
#endif #endif
#ifdef VK_USE_PLATFORM_XCB_KHR #ifdef VK_USE_PLATFORM_XCB_KHR
bool has_xcb = !!getenv("DISPLAY"); bool has_xcb = !!os_get_option("DISPLAY");
#endif #endif
for (unsigned i = 0; i < pCreateInfo->enabledExtensionCount; i++) { for (unsigned i = 0; i < pCreateInfo->enabledExtensionCount; i++) {