Compare commits

...

5 Commits

Author SHA1 Message Date
jikstra
ea7da1661b rename success to ok_to_continue 2019-08-09 19:22:40 +02:00
Jikstra
144858b318 Merge branch 'master' into remove_gotos_dc_msg 2019-08-09 15:36:58 +02:00
jikstra
ba02406cb0 Rename OK_TO_CONTINUE variable to success and remove linter exception 2019-08-03 12:43:54 +02:00
jikstra
32fd3242e9 run cargo fmt 2019-07-29 16:31:33 +02:00
jikstra
ff3f96df48 Replace goto/current_block logic in dc_msg with OK_TO_CONTINUE approach. Keeps indentation 2019-07-29 16:30:42 +02:00

View File

@@ -786,7 +786,7 @@ pub unsafe fn dc_msg_get_summary<'a>(
msg: *mut dc_msg_t<'a>,
mut chat: *const Chat<'a>,
) -> *mut dc_lot_t {
let current_block: u64;
let mut ok_to_continue = true;
let ret: *mut dc_lot_t = dc_lot_new();
let mut chat_to_delete: *mut Chat = 0 as *mut Chat;
@@ -794,27 +794,23 @@ pub unsafe fn dc_msg_get_summary<'a>(
if chat.is_null() {
chat_to_delete = dc_get_chat((*msg).context, (*msg).chat_id);
if chat_to_delete.is_null() {
current_block = 15204159476013091401;
} else {
chat = chat_to_delete;
current_block = 7815301370352969686;
ok_to_continue = false;
}
} else {
current_block = 7815301370352969686;
ok_to_continue = false;
}
match current_block {
15204159476013091401 => {}
_ => {
let contact = if (*msg).from_id != DC_CONTACT_ID_SELF as libc::c_uint
&& ((*chat).type_0 == 120 || (*chat).type_0 == 130)
{
Contact::get_by_id((*chat).context, (*msg).from_id).ok()
} else {
None
};
if ok_to_continue == false {
let contact = if (*msg).from_id != DC_CONTACT_ID_SELF as libc::c_uint
&& ((*chat).type_0 == 120 || (*chat).type_0 == 130)
{
Contact::get_by_id((*chat).context, (*msg).from_id).ok()
} else {
None
};
dc_lot_fill(ret, msg, chat, contact.as_ref(), (*msg).context);
}
dc_lot_fill(ret, msg, chat, contact.as_ref(), (*msg).context);
}
}