Avoid excessive allocation in dc_search_msgs

This commit is contained in:
Dmitry Bogatov
2019-09-12 07:37:00 +00:00
parent f47652e72d
commit bef25ad5f6

View File

@@ -506,12 +506,12 @@ pub fn dc_search_msgs(
return Vec::new(); return Vec::new();
} }
let real_query = to_string(query).trim().to_string(); let real_query = as_str(query).trim();
if real_query.is_empty() { if real_query.is_empty() {
return Vec::new(); return Vec::new();
} }
let strLikeInText = format!("%{}%", &real_query); let strLikeInText = format!("%{}%", real_query);
let strLikeBeg = format!("{}%", &real_query); let strLikeBeg = format!("{}%", real_query);
let query = if 0 != chat_id { let query = if 0 != chat_id {
"SELECT m.id, m.timestamp FROM msgs m LEFT JOIN contacts ct ON m.from_id=ct.id WHERE m.chat_id=? \ "SELECT m.id, m.timestamp FROM msgs m LEFT JOIN contacts ct ON m.from_id=ct.id WHERE m.chat_id=? \