Skip to content

Commit

Permalink
Use &CStr instead of &str
Browse files Browse the repository at this point in the history
  • Loading branch information
FlannyH committed Jan 22, 2024
1 parent c45fb26 commit 8a39e34
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ struct IRMetalLibBinaryOpaque;
struct IRShaderReflectionOpaque;
struct IRErrorOpaque;

use std::mem::MaybeUninit;
use std::{ffi::CStr, mem::MaybeUninit};

#[repr(i32)]
pub enum IRReflectionVersion {
Expand Down Expand Up @@ -325,9 +325,12 @@ impl<'lib> IRObject<'lib> {
}
}

pub fn gather_raytracing_intrinsics(&self, entry_point: &str) -> u64 {
pub fn gather_raytracing_intrinsics(&self, entry_point: &CStr) -> u64 {
unsafe {
(self.funcs.gather_raytracing_intrinsics)(self.me, entry_point.as_ptr() as *const i8)
(self.funcs.gather_raytracing_intrinsics)(
self.me,
<*const u8>::cast::<i8>(entry_point.to_bytes_with_nul().as_ptr()),
)
}
}

Expand Down

0 comments on commit 8a39e34

Please sign in to comment.