mirror of
https://github.com/chatmail/core.git
synced 2026-05-22 16:26:31 +03:00
Create dc_array_t in dc_get_locations without unsafe
This commit is contained in:
@@ -247,17 +247,12 @@ pub fn dc_get_locations(
|
|||||||
Ok(loc)
|
Ok(loc)
|
||||||
},
|
},
|
||||||
|locations| {
|
|locations| {
|
||||||
let ret = dc_array_new_locations(500);
|
let mut ret = dc_array_t::new_locations(500);
|
||||||
|
|
||||||
for location in locations {
|
for location in locations {
|
||||||
unsafe {
|
ret.add_ptr(Box::into_raw(Box::new(location?)) as *mut libc::c_void);
|
||||||
dc_array_add_ptr(
|
|
||||||
ret,
|
|
||||||
Box::into_raw(Box::new(location?)) as *mut libc::c_void,
|
|
||||||
)
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
Ok(ret)
|
Ok(ret.as_ptr())
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
.unwrap_or_else(|_| std::ptr::null_mut())
|
.unwrap_or_else(|_| std::ptr::null_mut())
|
||||||
|
|||||||
Reference in New Issue
Block a user