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:
@@ -157,12 +157,10 @@ device_select_CreateInstance(const VkInstanceCreateInfo *pCreateInfo,
|
||||
|
||||
info->debug = debug_get_bool_option("MESA_VK_DEVICE_SELECT_DEBUG", false) ||
|
||||
debug_get_bool_option("DRI_PRIME_DEBUG", false);
|
||||
info->selection = getenv("MESA_VK_DEVICE_SELECT");
|
||||
info->dri_prime = getenv("DRI_PRIME");
|
||||
info->selection = os_get_option_dup("MESA_VK_DEVICE_SELECT");
|
||||
info->dri_prime = os_get_option_dup("DRI_PRIME");
|
||||
info->force_default_device =
|
||||
debug_get_bool_option("MESA_VK_DEVICE_SELECT_FORCE_DEFAULT_DEVICE", false);
|
||||
info->selection = info->selection ? strdup(info->selection) : NULL;
|
||||
info->dri_prime = info->dri_prime ? strdup(info->dri_prime) : NULL;
|
||||
|
||||
#define DEVSEL_GET_CB(func) \
|
||||
info->func = (PFN_vk##func)info->GetInstanceProcAddr(*pInstance, "vk" #func)
|
||||
|
||||
Reference in New Issue
Block a user