use crate::ffi::{_efree, _emalloc};
use std::{alloc::Layout, ffi::c_void};
pub fn emalloc(layout: Layout) -> *mut u8 {
let size = layout.size();
(unsafe {
#[cfg(php_debug)]
{
_emalloc(size as _, std::ptr::null_mut(), 0, std::ptr::null_mut(), 0)
}
#[cfg(not(php_debug))]
{
_emalloc(size as _)
}
}) as *mut u8
}
pub unsafe fn efree(ptr: *mut u8) {
#[cfg(php_debug)]
{
_efree(
ptr as *mut c_void,
std::ptr::null_mut(),
0,
std::ptr::null_mut(),
0,
)
}
#[cfg(not(php_debug))]
{
_efree(ptr as *mut c_void)
}
}