mirror of
https://github.com/chatmail/core.git
synced 2026-05-08 09:26:29 +03:00
Simplify clist_search_string_nocase using Iterator interface
This commit is contained in:
@@ -436,19 +436,11 @@ pub unsafe fn clist_search_string_nocase(
|
|||||||
haystack: *const clist,
|
haystack: *const clist,
|
||||||
needle: *const libc::c_char,
|
needle: *const libc::c_char,
|
||||||
) -> libc::c_int {
|
) -> libc::c_int {
|
||||||
let mut iter = (*haystack).first;
|
for data in &*haystack {
|
||||||
|
if strcasecmp(data.cast(), needle) == 0 {
|
||||||
while !iter.is_null() {
|
|
||||||
if strcasecmp((*iter).data as *const libc::c_char, needle) == 0 {
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
iter = if !iter.is_null() {
|
|
||||||
(*iter).next
|
|
||||||
} else {
|
|
||||||
ptr::null_mut()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
0
|
0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user