mirror of
https://github.com/chatmail/core.git
synced 2026-05-02 21:06:31 +03:00
Move dc_array_search_id into dc_array_t implementation
This commit is contained in:
@@ -71,6 +71,15 @@ impl dc_array_t {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn search_id(&self, needle: uintptr_t) -> Option<usize> {
|
||||||
|
for (i, &u) in self.array.iter().enumerate() {
|
||||||
|
if u == needle {
|
||||||
|
return Some(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
None
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -258,15 +267,14 @@ pub unsafe fn dc_array_search_id(
|
|||||||
if array.is_null() {
|
if array.is_null() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
for (i, &u) in (*array).array.iter().enumerate() {
|
if let Some(i) = (*array).search_id(needle as uintptr_t) {
|
||||||
if u == needle as size_t {
|
if !ret_index.is_null() {
|
||||||
if !ret_index.is_null() {
|
*ret_index = i
|
||||||
*ret_index = i
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
true
|
||||||
|
} else {
|
||||||
|
false
|
||||||
}
|
}
|
||||||
false
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub unsafe fn dc_array_get_raw(array: *const dc_array_t) -> *const uintptr_t {
|
pub unsafe fn dc_array_get_raw(array: *const dc_array_t) -> *const uintptr_t {
|
||||||
|
|||||||
Reference in New Issue
Block a user