mirror of
https://github.com/chatmail/core.git
synced 2026-05-02 04:46:29 +03:00
Make dc_mimeparser_parse() return parser instead of modifying reference
Since dc_mimeparser_parse() called `dc_mimeparser_empty()' on passed reference anyway, it makes more sense to create new instance of `dc_mimeparser_t' and return it instead. Previously, usage pattern was following: dc_mimeparser_new() dc_mimeparser_empty() // semantically no-op, called inside dc_mimeparser_parse Now call to dc_mimeparser_empty() is avoided.
This commit is contained in:
committed by
Floris Bruynooghe
parent
21976b14a6
commit
8e4a01c98d
@@ -56,9 +56,8 @@ pub unsafe fn dc_receive_imf(
|
||||
// we use mailmime_parse() through dc_mimeparser (both call mailimf_struct_multiple_parse()
|
||||
// somewhen, I did not found out anything that speaks against this approach yet)
|
||||
|
||||
let mut mime_parser = dc_mimeparser_new(context);
|
||||
let body = std::slice::from_raw_parts(imf_raw_not_terminated as *const u8, imf_raw_bytes);
|
||||
dc_mimeparser_parse(&mut mime_parser, body);
|
||||
let mut mime_parser = dc_mimeparser_parse(context, body);
|
||||
|
||||
if mime_parser.header.is_empty() {
|
||||
// Error - even adding an empty record won't help as we do not know the message ID
|
||||
|
||||
Reference in New Issue
Block a user