use std::ffi::CString;
use std::ptr;
use crate::ffi::sapi_module_struct;
pub type SapiModule = sapi_module_struct;
unsafe impl Send for SapiModule {}
unsafe impl Sync for SapiModule {}
pub unsafe fn cleanup_sapi_allocations(module: *mut SapiModule) {
let module = unsafe { &mut *module };
if !module.name.is_null() {
unsafe { drop(CString::from_raw(module.name)) };
module.name = ptr::null_mut();
}
if !module.pretty_name.is_null() {
unsafe { drop(CString::from_raw(module.pretty_name)) };
module.pretty_name = ptr::null_mut();
}
if !module.executable_location.is_null() {
unsafe { drop(CString::from_raw(module.executable_location)) };
module.executable_location = ptr::null_mut();
}
if !module.php_ini_path_override.is_null() {
unsafe { drop(CString::from_raw(module.php_ini_path_override)) };
module.php_ini_path_override = ptr::null_mut();
}
}