/// Extend the buffer p so it has a size of at least min_size.
///
/// If the current size is large enough, nothing is changed.
///
/// Note: this does not check the available space!  The caller
///  is responsible for performing those calculations.
unsafe extern "C" fn printbuf_extend(
    mut p: *mut crate::src::printbuf::printbuf,
    mut min_size: ::core::ffi::c_int,
) -> ::core::ffi::c_int {
    let mut t: *mut ::core::ffi::c_char = ::core::ptr::null_mut::<::core::ffi::c_char>();
    let mut new_size: ::core::ffi::c_int = 0;
    if (*p).size >= min_size {
        return 0 as ::core::ffi::c_int;
    }
    new_size = (*p).size * 2 as ::core::ffi::c_int;
    if new_size < min_size + 8 as ::core::ffi::c_int {
        new_size = min_size + 8 as ::core::ffi::c_int;
    }
    /* PRINTBUF_DEBUG */
    t = realloc((*p).buf as *mut ::core::ffi::c_void, new_size as size_t)
        as *mut ::core::ffi::c_char;
    if t.is_null() {
        return -(1 as ::core::ffi::c_int);
    }
    (*p).size = new_size;
    (*p).buf = t;
    return 0 as ::core::ffi::c_int;
}