mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-03 05:38:16 +02:00
rusticl/core: Use C-string literals for XPlatManager::get_proc_address_func
Reviewed-by: Karol Herbst <kherbst@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31510>
This commit is contained in:
parent
fab6fa2bc8
commit
b9ccee0071
1 changed files with 4 additions and 5 deletions
|
|
@ -41,15 +41,14 @@ impl XPlatManager {
|
|||
pub fn new() -> Self {
|
||||
Self {
|
||||
#[cfg(glx)]
|
||||
glx_get_proc_addr: Self::get_proc_address_func("glXGetProcAddress"),
|
||||
egl_get_proc_addr: Self::get_proc_address_func("eglGetProcAddress"),
|
||||
glx_get_proc_addr: Self::get_proc_address_func(c"glXGetProcAddress"),
|
||||
egl_get_proc_addr: Self::get_proc_address_func(c"eglGetProcAddress"),
|
||||
}
|
||||
}
|
||||
|
||||
fn get_proc_address_func<T>(name: &str) -> T {
|
||||
let cname = CString::new(name).unwrap();
|
||||
fn get_proc_address_func<T>(name: &CStr) -> T {
|
||||
unsafe {
|
||||
let pfn = dlsym(ptr::null_mut(), cname.as_ptr());
|
||||
let pfn = dlsym(ptr::null_mut(), name.as_ptr());
|
||||
mem::transmute_copy(&pfn)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue