util,vulkan,llvmpipe: Use os_get_option_dup instead getenv

Use os_get_option_dup in
src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
src/util/tests/process_test.c
because the string is going to be modified.

Use os_get_option_dup in device_select_layer.c are because the string is being assigned to a
struct member (protection for the future), and also because the consecutive usages (protection for the present).

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Acked-by: Antonio Ospite <antonio.ospite@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38128>
This commit is contained in:
Yonggang Luo
2025-10-29 16:04:47 +08:00
committed by Marge Bot
parent a8e8422170
commit 2eee9b79e8
3 changed files with 6 additions and 7 deletions
+2 -2
View File
@@ -24,6 +24,7 @@
/* A collection of unit tests for u_process.c */
#include "util/detect_os.h"
#include "util/os_misc.h"
#include "util/u_process.h"
#include <stdio.h>
#include <stdbool.h>
@@ -88,13 +89,12 @@ test_util_get_process_exec_path (void)
return;
}
posixify_path(path);
char* build_path = getenv("BUILD_FULL_PATH");
char* build_path = os_get_option_dup("BUILD_FULL_PATH");
if (!build_path) {
fprintf(stderr, "BUILD_FULL_PATH environment variable should be set\n");
error = true;
return;
}
build_path = strdup(build_path);
posixify_path(build_path);
#ifdef __CYGWIN__
int i = strlen(build_path) - 4;