remove gotos from new_data_part function

This commit is contained in:
jikstra
2019-08-07 20:52:18 +02:00
parent 76b3c532b1
commit ac2f9fdee5

View File

@@ -378,7 +378,7 @@ unsafe fn new_data_part(
default_content_type: *mut libc::c_char, default_content_type: *mut libc::c_char,
default_encoding: libc::c_int, default_encoding: libc::c_int,
) -> *mut mailmime { ) -> *mut mailmime {
let mut current_block: u64; let mut ok_to_continue = true;
//char basename_buf[PATH_MAX]; //char basename_buf[PATH_MAX];
let mut encoding: *mut mailmime_mechanism; let mut encoding: *mut mailmime_mechanism;
let content: *mut mailmime_content; let content: *mut mailmime_content;
@@ -398,7 +398,7 @@ unsafe fn new_data_part(
} }
content = mailmime_content_new_with_str(content_type_str); content = mailmime_content_new_with_str(content_type_str);
if content.is_null() { if content.is_null() {
current_block = 16266721588079097885; ok_to_continue = false;
} else { } else {
do_encoding = 1i32; do_encoding = 1i32;
if (*(*content).ct_type).tp_type == MAILMIME_TYPE_COMPOSITE_TYPE as libc::c_int { if (*(*content).ct_type).tp_type == MAILMIME_TYPE_COMPOSITE_TYPE as libc::c_int {
@@ -426,16 +426,10 @@ unsafe fn new_data_part(
} }
encoding = mailmime_mechanism_new(encoding_type, 0 as *mut libc::c_char); encoding = mailmime_mechanism_new(encoding_type, 0 as *mut libc::c_char);
if encoding.is_null() { if encoding.is_null() {
current_block = 16266721588079097885; ok_to_continue = false;
} else { }
current_block = 11057878835866523405;
}
} else {
current_block = 11057878835866523405;
} }
match current_block { if ok_to_continue {
16266721588079097885 => {}
_ => {
mime_fields = mailmime_fields_new_with_data( mime_fields = mailmime_fields_new_with_data(
encoding, encoding,
0 as *mut libc::c_char, 0 as *mut libc::c_char,
@@ -444,7 +438,7 @@ unsafe fn new_data_part(
0 as *mut mailmime_language, 0 as *mut mailmime_language,
); );
if mime_fields.is_null() { if mime_fields.is_null() {
current_block = 16266721588079097885; ok_to_continue = false;
} else { } else {
mime = mailmime_new_empty(content, mime_fields); mime = mailmime_new_empty(content, mime_fields);
if mime.is_null() { if mime.is_null() {
@@ -459,21 +453,17 @@ unsafe fn new_data_part(
} }
return mime; return mime;
} }
current_block = 13668317689588454213;
} }
}
} }
} }
match current_block {
16266721588079097885 => { if ok_to_continue == false {
if !encoding.is_null() { if !encoding.is_null() {
mailmime_mechanism_free(encoding); mailmime_mechanism_free(encoding);
} }
if !content.is_null() { if !content.is_null() {
mailmime_content_free(content); mailmime_content_free(content);
} }
}
_ => {}
} }
return 0 as *mut mailmime; return 0 as *mut mailmime;
} }