mirror of
https://github.com/chatmail/core.git
synced 2026-04-20 23:16:30 +03:00
reduce code duplication (round 1)
This commit is contained in:
@@ -1,155 +1,9 @@
|
||||
use libc;
|
||||
|
||||
use crate::dc_tools::*;
|
||||
use crate::types::*;
|
||||
use crate::x::*;
|
||||
|
||||
extern "C" {
|
||||
#[no_mangle]
|
||||
static mut _DefaultRuneLocale: _RuneLocale;
|
||||
#[no_mangle]
|
||||
fn __maskrune(_: __darwin_ct_rune_t, _: libc::c_ulong) -> libc::c_int;
|
||||
#[no_mangle]
|
||||
fn __tolower(_: __darwin_ct_rune_t) -> __darwin_ct_rune_t;
|
||||
#[no_mangle]
|
||||
fn mmap_string_new(init: *const libc::c_char) -> *mut MMAPString;
|
||||
#[no_mangle]
|
||||
fn mmap_string_free(string: *mut MMAPString);
|
||||
#[no_mangle]
|
||||
fn mmap_string_append(string: *mut MMAPString, val: *const libc::c_char) -> *mut MMAPString;
|
||||
#[no_mangle]
|
||||
fn mmap_string_append_len(
|
||||
string: *mut MMAPString,
|
||||
val: *const libc::c_char,
|
||||
len: size_t,
|
||||
) -> *mut MMAPString;
|
||||
#[no_mangle]
|
||||
fn mmap_string_append_c(string: *mut MMAPString, c: libc::c_char) -> *mut MMAPString;
|
||||
#[no_mangle]
|
||||
fn snprintf(
|
||||
_: *mut libc::c_char,
|
||||
_: libc::c_ulong,
|
||||
_: *const libc::c_char,
|
||||
_: ...
|
||||
) -> libc::c_int;
|
||||
#[no_mangle]
|
||||
fn mailmime_encoded_phrase_parse(
|
||||
default_fromcode: *const libc::c_char,
|
||||
message: *const libc::c_char,
|
||||
length: size_t,
|
||||
indx: *mut size_t,
|
||||
tocode: *const libc::c_char,
|
||||
result: *mut *mut libc::c_char,
|
||||
) -> libc::c_int;
|
||||
#[no_mangle]
|
||||
fn charconv(
|
||||
tocode: *const libc::c_char,
|
||||
fromcode: *const libc::c_char,
|
||||
str: *const libc::c_char,
|
||||
length: size_t,
|
||||
result: *mut *mut libc::c_char,
|
||||
) -> libc::c_int;
|
||||
#[no_mangle]
|
||||
fn malloc(_: libc::c_ulong) -> *mut libc::c_void;
|
||||
#[no_mangle]
|
||||
fn free(_: *mut libc::c_void);
|
||||
#[no_mangle]
|
||||
fn exit(_: libc::c_int) -> !;
|
||||
#[no_mangle]
|
||||
fn memset(_: *mut libc::c_void, _: libc::c_int, _: libc::c_ulong) -> *mut libc::c_void;
|
||||
#[no_mangle]
|
||||
fn strchr(_: *const libc::c_char, _: libc::c_int) -> *mut libc::c_char;
|
||||
#[no_mangle]
|
||||
fn strcmp(_: *const libc::c_char, _: *const libc::c_char) -> libc::c_int;
|
||||
#[no_mangle]
|
||||
fn strcpy(_: *mut libc::c_char, _: *const libc::c_char) -> *mut libc::c_char;
|
||||
#[no_mangle]
|
||||
fn strlen(_: *const libc::c_char) -> libc::c_ulong;
|
||||
#[no_mangle]
|
||||
fn strdup(_: *const libc::c_char) -> *mut libc::c_char;
|
||||
/* string tools */
|
||||
#[no_mangle]
|
||||
fn dc_strdup(_: *const libc::c_char) -> *mut libc::c_char;
|
||||
#[no_mangle]
|
||||
fn dc_null_terminate(_: *const libc::c_char, bytes: libc::c_int) -> *mut libc::c_char;
|
||||
}
|
||||
pub type __uint32_t = libc::c_uint;
|
||||
pub type __darwin_ct_rune_t = libc::c_int;
|
||||
pub type __darwin_size_t = libc::c_ulong;
|
||||
pub type __darwin_wchar_t = libc::c_int;
|
||||
pub type __darwin_rune_t = __darwin_wchar_t;
|
||||
pub type size_t = __darwin_size_t;
|
||||
#[derive(Copy, Clone)]
|
||||
#[repr(C)]
|
||||
pub struct _RuneEntry {
|
||||
pub __min: __darwin_rune_t,
|
||||
pub __max: __darwin_rune_t,
|
||||
pub __map: __darwin_rune_t,
|
||||
pub __types: *mut __uint32_t,
|
||||
}
|
||||
#[derive(Copy, Clone)]
|
||||
#[repr(C)]
|
||||
pub struct _RuneRange {
|
||||
pub __nranges: libc::c_int,
|
||||
pub __ranges: *mut _RuneEntry,
|
||||
}
|
||||
#[derive(Copy, Clone)]
|
||||
#[repr(C)]
|
||||
pub struct _RuneCharClass {
|
||||
pub __name: [libc::c_char; 14],
|
||||
pub __mask: __uint32_t,
|
||||
}
|
||||
#[derive(Copy, Clone)]
|
||||
#[repr(C)]
|
||||
pub struct _RuneLocale {
|
||||
pub __magic: [libc::c_char; 8],
|
||||
pub __encoding: [libc::c_char; 32],
|
||||
pub __sgetrune: Option<
|
||||
unsafe extern "C" fn(
|
||||
_: *const libc::c_char,
|
||||
_: __darwin_size_t,
|
||||
_: *mut *const libc::c_char,
|
||||
) -> __darwin_rune_t,
|
||||
>,
|
||||
pub __sputrune: Option<
|
||||
unsafe extern "C" fn(
|
||||
_: __darwin_rune_t,
|
||||
_: *mut libc::c_char,
|
||||
_: __darwin_size_t,
|
||||
_: *mut *mut libc::c_char,
|
||||
) -> libc::c_int,
|
||||
>,
|
||||
pub __invalid_rune: __darwin_rune_t,
|
||||
pub __runetype: [__uint32_t; 256],
|
||||
pub __maplower: [__darwin_rune_t; 256],
|
||||
pub __mapupper: [__darwin_rune_t; 256],
|
||||
pub __runetype_ext: _RuneRange,
|
||||
pub __maplower_ext: _RuneRange,
|
||||
pub __mapupper_ext: _RuneRange,
|
||||
pub __variable: *mut libc::c_void,
|
||||
pub __variable_len: libc::c_int,
|
||||
pub __ncharclasses: libc::c_int,
|
||||
pub __charclasses: *mut _RuneCharClass,
|
||||
}
|
||||
#[derive(Copy, Clone)]
|
||||
#[repr(C)]
|
||||
pub struct _MMAPString {
|
||||
pub str_0: *mut libc::c_char,
|
||||
pub len: size_t,
|
||||
pub allocated_len: size_t,
|
||||
pub fd: libc::c_int,
|
||||
pub mmapped_size: size_t,
|
||||
}
|
||||
pub type MMAPString = _MMAPString;
|
||||
pub type unnamed = libc::c_uint;
|
||||
pub const MAILIMF_ERROR_FILE: unnamed = 4;
|
||||
pub const MAILIMF_ERROR_INVAL: unnamed = 3;
|
||||
pub const MAILIMF_ERROR_MEMORY: unnamed = 2;
|
||||
pub const MAILIMF_ERROR_PARSE: unnamed = 1;
|
||||
pub const MAILIMF_NO_ERROR: unnamed = 0;
|
||||
pub type unnamed_0 = libc::c_uint;
|
||||
pub const MAIL_CHARCONV_ERROR_CONV: unnamed_0 = 3;
|
||||
pub const MAIL_CHARCONV_ERROR_MEMORY: unnamed_0 = 2;
|
||||
pub const MAIL_CHARCONV_ERROR_UNKNOWN_CHARSET: unnamed_0 = 1;
|
||||
pub const MAIL_CHARCONV_NO_ERROR: unnamed_0 = 0;
|
||||
#[inline]
|
||||
unsafe extern "C" fn isascii(mut _c: libc::c_int) -> libc::c_int {
|
||||
return (_c & !0x7fi32 == 0i32) as libc::c_int;
|
||||
|
||||
Reference in New Issue
Block a user