mirror of
https://github.com/chatmail/core.git
synced 2026-05-24 09:16:32 +03:00
Replace C loop with Rust loop in dc_array_search_id
This commit is contained in:
@@ -237,16 +237,13 @@ pub unsafe fn dc_array_search_id(
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
let data: *mut uintptr_t = (*array).array;
|
let data: *mut uintptr_t = (*array).array;
|
||||||
let mut i: size_t = 0;
|
for i in 0..(*array).count {
|
||||||
let cnt: size_t = (*array).count;
|
|
||||||
while i < cnt {
|
|
||||||
if *data.offset(i as isize) == needle as size_t {
|
if *data.offset(i as isize) == needle as size_t {
|
||||||
if !ret_index.is_null() {
|
if !ret_index.is_null() {
|
||||||
*ret_index = i
|
*ret_index = i
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
i = i.wrapping_add(1)
|
|
||||||
}
|
}
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user