refactor(mmime): remove some duplication

This commit is contained in:
dignifiedquire
2019-09-26 00:45:20 +02:00
parent 452bce07e1
commit dd4adb57cf
2 changed files with 4 additions and 8 deletions

View File

@@ -43,15 +43,14 @@ pub struct mailimf_date_time {
pub dt_zone: libc::c_int,
}
/* this is the type of address */
pub type unnamed = libc::c_uint;
/* if this is a group
(group_name: address1@domain1,
address2@domain2; ) */
pub const MAILIMF_ADDRESS_GROUP: unnamed = 2;
pub const MAILIMF_ADDRESS_GROUP: libc::c_uint = 2;
/* if this is a mailbox (mailbox@domain) */
pub const MAILIMF_ADDRESS_MAILBOX: unnamed = 1;
pub const MAILIMF_ADDRESS_MAILBOX: libc::c_uint = 1;
/* on parse error */
pub const MAILIMF_ADDRESS_ERROR: unnamed = 0;
pub const MAILIMF_ADDRESS_ERROR: libc::c_uint = 0;
/*
mailimf_address is an address

View File

@@ -8,9 +8,6 @@ use crate::mailmime::types::*;
use crate::mmapstring::*;
use crate::other::*;
pub const MAIL_CHARCONV_ERROR_CONV: libc::c_uint = 3;
pub const MAIL_CHARCONV_ERROR_UNKNOWN_CHARSET: libc::c_uint = 1;
pub const MAIL_CHARCONV_ERROR_MEMORY: libc::c_uint = 2;
pub const TYPE_WORD: libc::c_uint = 1;
pub const TYPE_ENCODED_WORD: libc::c_uint = 2;
pub const MAILMIME_ENCODING_Q: libc::c_uint = 1;
@@ -850,7 +847,7 @@ unsafe fn mailmime_etoken_parse(
return mailimf_custom_string_parse(message, length, indx, result, Some(is_etoken_char));
}
pub unsafe fn is_etoken_char(mut ch: libc::c_char) -> libc::c_int {
unsafe fn is_etoken_char(mut ch: libc::c_char) -> libc::c_int {
let mut uch: libc::c_uchar = ch as libc::c_uchar;
if (uch as libc::c_int) < 31i32 {
return 0i32;