pub unsafe fn mailimf_mailbox_parse(
    mut message: *const libc::c_char,
    mut length: size_t,
    mut indx: *mut size_t,
    mut result: *mut *mut mailimf_mailbox,
) -> libc::c_int {
    let mut cur_token: size_t = 0;
    let mut display_name: *mut libc::c_char = 0 as *mut libc::c_char;
    let mut mailbox: *mut mailimf_mailbox = 0 as *mut mailimf_mailbox;
    let mut addr_spec: *mut libc::c_char = 0 as *mut libc::c_char;
    let mut r: libc::c_int = 0;
    let mut res: libc::c_int = 0;
    cur_token = *indx;
    display_name = 0 as *mut libc::c_char;
    addr_spec = 0 as *mut libc::c_char;
    r = mailimf_name_addr_parse(
        message,
        length,
        &mut cur_token,
        &mut display_name,
        &mut addr_spec,
    );
    if r == MAILIMF_ERROR_PARSE as libc::c_int {
        r = mailimf_addr_spec_parse(message, length, &mut cur_token, &mut addr_spec)
    }
    if r != MAILIMF_NO_ERROR as libc::c_int {
        res = r
    } else {
        mailbox = mailimf_mailbox_new(display_name, addr_spec);
        if mailbox.is_null() {
            res = MAILIMF_ERROR_MEMORY as libc::c_int;
            if !display_name.is_null() {
                mailimf_display_name_free(display_name);
            }
            if !addr_spec.is_null() {
                mailimf_addr_spec_free(addr_spec);
            }
        } else {
            *result = mailbox;
            *indx = cur_token;
            return MAILIMF_NO_ERROR as libc::c_int;
        }
    }
    return res;
}
/*
  mailimf_mailbox_parse will parse the given address

  @param message this is a string containing the mailbox
  @param length this is the size of the given string
  @param indx this is a pointer to the start of the mailbox in
    the given string, (* indx) is modified to point at the end
    of the parsed data
  @param result the result of the parse operation is stored in
    (* result)

  @return MAILIMF_NO_ERROR on success, MAILIMF_ERROR_XXX on error
*/
mailimf_mailbox_parse will parse the given address
mailimf_mailbox_parse will parse the given address
pub unsafe fn mailimf_mailbox_parse(
    mut message: *const libc::c_char,
    mut length: size_t,
    mut indx: *mut size_t,
    mut result: *mut *mut mailimf_mailbox,
) -> libc::c_int {
    let mut cur_token: size_t = 0;
    let mut display_name: *mut libc::c_char = 0 as *mut libc::c_char;
    let mut mailbox: *mut mailimf_mailbox = 0 as *mut mailimf_mailbox;
    let mut addr_spec: *mut libc::c_char = 0 as *mut libc::c_char;
    let mut r: libc::c_int = 0;
    let mut res: libc::c_int = 0;
    cur_token = *indx;
    display_name = 0 as *mut libc::c_char;
    addr_spec = 0 as *mut libc::c_char;
    r = mailimf_name_addr_parse(
        message,
        length,
        &mut cur_token,
        &mut display_name,
        &mut addr_spec,
    );
    if r == MAILIMF_ERROR_PARSE as libc::c_int {
        r = mailimf_addr_spec_parse(message, length, &mut cur_token, &mut addr_spec)
    }
    if r != MAILIMF_NO_ERROR as libc::c_int {
        res = r
    } else {
        mailbox = mailimf_mailbox_new(display_name, addr_spec);
        if mailbox.is_null() {
            res = MAILIMF_ERROR_MEMORY as libc::c_int;
            if !display_name.is_null() {
                mailimf_display_name_free(display_name);
            }
            if !addr_spec.is_null() {
                mailimf_addr_spec_free(addr_spec);
            }
        } else {
            *result = mailbox;
            *indx = cur_token;
            return MAILIMF_NO_ERROR as libc::c_int;
        }
    }
    return res;
}
pub unsafe fn mailimf_mailbox_parse ( mut message : * const libc :: c_char , mut length : size_t , mut indx : * mut size_t , mut result : * mut * mut mailimf_mailbox , ) -> libc :: c_int { let mut cur_token : size_t = 0 ; let mut display_name : * mut libc :: c_char = 0 as * mut libc :: c_char ; let mut mailbox : * mut mailimf_mailbox = 0 as * mut mailimf_mailbox ; let mut addr_spec : * mut libc :: c_char = 0 as * mut libc :: c_char ; let mut r : libc :: c_int = 0 ; let mut res : libc :: c_int = 0 ; cur_token = * indx ; display_name = 0 as * mut libc :: c_char ; addr_spec = 0 as * mut libc :: c_char ; r = mailimf_name_addr_parse ( message , length , & mut cur_token , & mut display_name , & mut addr_spec , ) ; if r == MAILIMF_ERROR_PARSE as libc :: c_int { r = mailimf_addr_spec_parse ( message , length , & mut cur_token , & mut addr_spec ) } if r != MAILIMF_NO_ERROR as libc :: c_int { res = r } else { mailbox = mailimf_mailbox_new ( display_name , addr_spec ) ; if mailbox . is_null ( ) { res = MAILIMF_ERROR_MEMORY as libc :: c_int ; if ! display_name . is_null ( ) { mailimf_display_name_free ( display_name ) ; } if ! addr_spec . is_null ( ) { mailimf_addr_spec_free ( addr_spec ) ; } } else { * result = mailbox ; * indx = cur_token ; return MAILIMF_NO_ERROR as libc :: c_int ; } } return res ; }
mailimf_mailbox_parse will parse the given address
mailimf_mailbox_parse will parse the given address
message
*const libc::c_char
length
size_t
indx
*mut size_t
result
*mut *mut mailimf_mailbox
MAILIMF_NO_ERROR on success, MAILIMF_ERROR_XXX on error
MAILIMF_NO_ERROR on success MAILIMF_ERROR_XXX on error
message
*const libc::c_char
this is a string containing the mailbox
this is a string containing the mailbox
length
size_t
this is the size of the given string
this is the size of the given string
indx
*mut size_t
this is a pointer to the start of the mailbox in
the given string, (* indx) is modified to point at the end
of the parsed data
this is a pointer to the start of the mailbox in the given string ( * indx ) is modified to point at the end of the parsed data
result
*mut *mut mailimf_mailbox
the result of the parse operation is stored in
(* result)
the result of the parse operation is stored in ( * result )