Skip to content
This repository was archived by the owner on Mar 20, 2024. It is now read-only.

Conversation

@kitcatier
Copy link

rust-egl/src/eglext.rs

Lines 45 to 60 in 7a2d4b1

pub fn CreateImageKHR(dpy: EGLDisplay, context: EGLContext, target: EGLenum,
buffer: EGLClientBuffer, attrib_list: *const EGLint) -> EGLImageKHR {
unsafe {
let name = ffi::CString::new("eglCreateImageKHR").unwrap();
let addr = eglGetProcAddress(name.as_ptr() as *const _);
if addr == ptr::null() {
panic!("Unable to find an entry point for eglCreateImageKHR");
}
let eglCreateImageKHR: extern "C" fn(dpy: EGLDisplay, context: EGLContext, target: EGLenum,
buffer: EGLClientBuffer, attrib_list: *const EGLint) -> EGLImageKHR = mem::transmute(addr);
return eglCreateImageKHR(dpy, context, target, buffer, attrib_list);
}
}

Hello, if a function's entire body is unsafe, the function is itself unsafe and should be marked appropriately, which will make the caller ignore the safety requirements that the function parameters must guarantee, the developer who calls the CreateImageKHR function may not notice this safety requirement.
Marking them unsafe also means that callers must make sure they know what they're doing.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant