use std::io;
use std::os::raw::c_char;
use {get_str, get_str_mib, name_to_mib};
const MALLOC_CONF: *const c_char = b"config.malloc_conf\0" as *const _ as *const _;
pub fn malloc_conf() -> io::Result<&'static str> {
unsafe { get_str(MALLOC_CONF) }
}
#[derive(Copy, Clone)]
pub struct MallocConf([usize; 2]);
impl MallocConf {
pub fn new() -> io::Result<MallocConf> {
unsafe {
let mut mib = [0; 2];
name_to_mib(MALLOC_CONF, &mut mib)?;
Ok(MallocConf(mib))
}
}
pub fn get(&self) -> io::Result<&'static str> {
unsafe { get_str_mib(&self.0) }
}
}