pub unsafe fn mailimf_fields_parse(
    mut message: *const libc::c_char,
    mut length: size_t,
    mut indx: *mut size_t,
    mut result: *mut *mut mailimf_fields,
) -> libc::c_int {
    let mut current_block: u64;
    let mut cur_token: size_t = 0;
    let mut list: *mut clist = 0 as *mut clist;
    let mut fields: *mut mailimf_fields = 0 as *mut mailimf_fields;
    let mut r: libc::c_int = 0;
    let mut res: libc::c_int = 0;
    cur_token = *indx;
    list = 0 as *mut clist;
    r = mailimf_struct_multiple_parse(
        message,
        length,
        &mut cur_token,
        &mut list,
        ::std::mem::transmute::<
            Option<
                unsafe fn(
                    _: *const libc::c_char,
                    _: size_t,
                    _: *mut size_t,
                    _: *mut *mut mailimf_field,
                ) -> libc::c_int,
            >,
            Option<
                unsafe fn(
                    _: *const libc::c_char,
                    _: size_t,
                    _: *mut size_t,
                    _: *mut libc::c_void,
                ) -> libc::c_int,
            >,
        >(Some(mailimf_field_parse)),
        ::std::mem::transmute::<
            Option<unsafe fn(_: *mut mailimf_field) -> ()>,
            Option<unsafe fn(_: *mut libc::c_void) -> libc::c_int>,
        >(Some(mailimf_field_free)),
    );
    /*
    if ((r != MAILIMF_NO_ERROR) && (r != MAILIMF_ERROR_PARSE)) {
      res = r;
      goto err;
    }
    */
    match r {
        0 => {
            /* do nothing */
            current_block = 11050875288958768710;
        }
        1 => {
            list = clist_new();
            if list.is_null() {
                res = MAILIMF_ERROR_MEMORY as libc::c_int;
                current_block = 6724962012950341805;
            } else {
                current_block = 11050875288958768710;
            }
        }
        _ => {
            res = r;
            current_block = 6724962012950341805;
        }
    }
    match current_block {
        11050875288958768710 => {
            fields = mailimf_fields_new(list);
            if fields.is_null() {
                res = MAILIMF_ERROR_MEMORY as libc::c_int;
                if !list.is_null() {
                    clist_foreach(
                        list,
                        ::std::mem::transmute::<
                            Option<unsafe fn(_: *mut mailimf_field) -> ()>,
                            clist_func,
                        >(Some(mailimf_field_free)),
                        0 as *mut libc::c_void,
                    );
                    clist_free(list);
                }
            } else {
                *result = fields;
                *indx = cur_token;
                return MAILIMF_NO_ERROR as libc::c_int;
            }
        }
        _ => {}
    }
    return res;
}
/*
  mailimf_fields_parse will parse the given header fields

  @param message this is a string containing the header fields
  @param length this is the size of the given string
  @param indx this is a pointer to the start of the header fields 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_fields_parse will parse the given header fields
mailimf_fields_parse will parse the given header fields
pub unsafe fn mailimf_fields_parse(
    mut message: *const libc::c_char,
    mut length: size_t,
    mut indx: *mut size_t,
    mut result: *mut *mut mailimf_fields,
) -> libc::c_int {
    let mut current_block: u64;
    let mut cur_token: size_t = 0;
    let mut list: *mut clist = 0 as *mut clist;
    let mut fields: *mut mailimf_fields = 0 as *mut mailimf_fields;
    let mut r: libc::c_int = 0;
    let mut res: libc::c_int = 0;
    cur_token = *indx;
    list = 0 as *mut clist;
    r = mailimf_struct_multiple_parse(
        message,
        length,
        &mut cur_token,
        &mut list,
        ::std::mem::transmute::<
            Option<
                unsafe fn(
                    _: *const libc::c_char,
                    _: size_t,
                    _: *mut size_t,
                    _: *mut *mut mailimf_field,
                ) -> libc::c_int,
            >,
            Option<
                unsafe fn(
                    _: *const libc::c_char,
                    _: size_t,
                    _: *mut size_t,
                    _: *mut libc::c_void,
                ) -> libc::c_int,
            >,
        >(Some(mailimf_field_parse)),
        ::std::mem::transmute::<
            Option<unsafe fn(_: *mut mailimf_field) -> ()>,
            Option<unsafe fn(_: *mut libc::c_void) -> libc::c_int>,
        >(Some(mailimf_field_free)),
    );
    /*
    if ((r != MAILIMF_NO_ERROR) && (r != MAILIMF_ERROR_PARSE)) {
      res = r;
      goto err;
    }
    */
    match r {
        0 => {
            /* do nothing */
            current_block = 11050875288958768710;
        }
        1 => {
            list = clist_new();
            if list.is_null() {
                res = MAILIMF_ERROR_MEMORY as libc::c_int;
                current_block = 6724962012950341805;
            } else {
                current_block = 11050875288958768710;
            }
        }
        _ => {
            res = r;
            current_block = 6724962012950341805;
        }
    }
    match current_block {
        11050875288958768710 => {
            fields = mailimf_fields_new(list);
            if fields.is_null() {
                res = MAILIMF_ERROR_MEMORY as libc::c_int;
                if !list.is_null() {
                    clist_foreach(
                        list,
                        ::std::mem::transmute::<
                            Option<unsafe fn(_: *mut mailimf_field) -> ()>,
                            clist_func,
                        >(Some(mailimf_field_free)),
                        0 as *mut libc::c_void,
                    );
                    clist_free(list);
                }
            } else {
                *result = fields;
                *indx = cur_token;
                return MAILIMF_NO_ERROR as libc::c_int;
            }
        }
        _ => {}
    }
    return res;
}
pub unsafe fn mailimf_fields_parse ( mut message : * const libc :: c_char , mut length : size_t , mut indx : * mut size_t , mut result : * mut * mut mailimf_fields , ) -> libc :: c_int { let mut current_block : u64 ; let mut cur_token : size_t = 0 ; let mut list : * mut clist = 0 as * mut clist ; let mut fields : * mut mailimf_fields = 0 as * mut mailimf_fields ; let mut r : libc :: c_int = 0 ; let mut res : libc :: c_int = 0 ; cur_token = * indx ; list = 0 as * mut clist ; r = mailimf_struct_multiple_parse ( message , length , & mut cur_token , & mut list , :: std :: mem :: transmute :: < Option < unsafe fn ( _ : * const libc :: c_char , _ : size_t , _ : * mut size_t , _ : * mut * mut mailimf_field , ) -> libc :: c_int , > , Option < unsafe fn ( _ : * const libc :: c_char , _ : size_t , _ : * mut size_t , _ : * mut libc :: c_void , ) -> libc :: c_int , > , > ( Some ( mailimf_field_parse ) ) , :: std :: mem :: transmute :: < Option < unsafe fn ( _ : * mut mailimf_field ) -> ( ) > , Option < unsafe fn ( _ : * mut libc :: c_void ) -> libc :: c_int > , > ( Some ( mailimf_field_free ) ) , ) ; /*
    if ((r != MAILIMF_NO_ERROR) && (r != MAILIMF_ERROR_PARSE)) {
      res = r;
      goto err;
    }
    */ match r { 0 => { /* do nothing */ current_block = 11050875288958768710 ; } 1 => { list = clist_new ( ) ; if list . is_null ( ) { res = MAILIMF_ERROR_MEMORY as libc :: c_int ; current_block = 6724962012950341805 ; } else { current_block = 11050875288958768710 ; } } _ => { res = r ; current_block = 6724962012950341805 ; } } match current_block { 11050875288958768710 => { fields = mailimf_fields_new ( list ) ; if fields . is_null ( ) { res = MAILIMF_ERROR_MEMORY as libc :: c_int ; if ! list . is_null ( ) { clist_foreach ( list , :: std :: mem :: transmute :: < Option < unsafe fn ( _ : * mut mailimf_field ) -> ( ) > , clist_func , > ( Some ( mailimf_field_free ) ) , 0 as * mut libc :: c_void , ) ; clist_free ( list ) ; } } else { * result = fields ; * indx = cur_token ; return MAILIMF_NO_ERROR as libc :: c_int ; } } _ => { } } return res ; }
mailimf_fields_parse will parse the given header fields
mailimf_fields_parse will parse the given header fields
message
*const libc::c_char
length
size_t
indx
*mut size_t
result
*mut *mut mailimf_fields
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 header fields
this is a string containing the header fields
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 header fields 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 header fields in the given string ( * indx ) is modified to point at the end of the parsed data
result
*mut *mut mailimf_fields
the result of the parse operation is stored in
(* result)
the result of the parse operation is stored in ( * result )