use grb_sys2 as ffi;
use std::ffi::CStr;
pub(crate) unsafe fn copy_c_str(s: ffi::c_str) -> String {
debug_assert!(!s.is_null());
CStr::from_ptr(s).to_string_lossy().into_owned() }
#[test]
fn conversion_must_succeed() {
use std::ffi::CString;
let s1 = "mip1.log";
let cs = CString::new(s1).unwrap();
let s2 = unsafe { copy_c_str(cs.as_ptr()) };
assert!(s1 == s2);
}
pub(crate) trait AsPtr {
type Ptr;
unsafe fn as_mut_ptr(&self) -> *mut Self::Ptr;
fn as_ptr(&self) -> *const Self::Ptr {
(unsafe { self.as_mut_ptr() }) as *const Self::Ptr
}
}