pub fn construct_libc_cstring_arr(elements_count: usize, null_terminated: bool) -> *mut *mut libc::c_char {
    let elements = if null_terminated { elements_count + 1 } else { elements_count };
    let ptr_size = get_c_ptr_size();
    let argv: *mut *mut libc::c_char;
    unsafe {
        // allocate memory for array of pointers
        // we use calloc for null terminated array
        argv = std::mem::transmute(
            libc::calloc(ptr_size, elements)
        );
    }
    argv
}
/// Constructs an array of C strings aka. array of `*mut libc::c_char"` on
/// the heap. Allocates memory. Memory must be freed manually somewhere in
/// order to have proper memory management.
/// I've chosen to use `*mut libc::c_char"` rather than `std::ffi::CStr`
/// because of educational purposes, to gain more experience, and just
/// for fun.
Constructs an array of C strings aka. array of `*mut libc::c_char"` on
the heap. Allocates memory. Memory must be freed manually somewhere in
order to have proper memory management.
Constructs an array of C strings aka . array of ` * mut libc :: c_char " ` on the heap . Allocates memory . Memory must be freed manually somewhere in order to have proper memory management .
pub fn construct_libc_cstring_arr(elements_count: usize, null_terminated: bool) -> *mut *mut libc::c_char {
    let elements = if null_terminated { elements_count + 1 } else { elements_count };
    let ptr_size = get_c_ptr_size();
    let argv: *mut *mut libc::c_char;
    unsafe {
        // allocate memory for array of pointers
        // we use calloc for null terminated array
        argv = std::mem::transmute(
            libc::calloc(ptr_size, elements)
        );
    }
    argv
}
pub fn construct_libc_cstring_arr ( elements_count : usize , null_terminated : bool ) -> * mut * mut libc :: c_char { let elements = if null_terminated { elements_count + 1 } else { elements_count } ; let ptr_size = get_c_ptr_size ( ) ; let argv : * mut * mut libc :: c_char ; unsafe { // allocate memory for array of pointers // we use calloc for null terminated array argv = std :: mem :: transmute ( libc :: calloc ( ptr_size , elements ) ) ; } argv }
Constructs an array of C strings aka.
Constructs an array of C strings aka .
elements_count
usize
null_terminated
bool
elements_count
usize
null_terminated
bool