Replace C loop with Rust loop in dc_array_search_id

This commit is contained in:
Alexander Krotov
2019-07-22 01:26:07 +03:00
parent 7585dc49e3
commit 7764ab3ff3

View File

@@ -237,16 +237,13 @@ pub unsafe fn dc_array_search_id(
return false;
}
let data: *mut uintptr_t = (*array).array;
let mut i: size_t = 0;
let cnt: size_t = (*array).count;
while i < cnt {
for i in 0..(*array).count {
if *data.offset(i as isize) == needle as size_t {
if !ret_index.is_null() {
*ret_index = i
}
return true;
}
i = i.wrapping_add(1)
}
false
}