dc_get_locations: use from(Vec<dc_location>) instead of add_location

This commit is contained in:
Alexander Krotov
2019-07-28 15:29:47 +03:00
parent 2688a397aa
commit 14e42b48bd

View File

@@ -250,12 +250,12 @@ pub fn dc_get_locations(
Ok(loc) Ok(loc)
}, },
|locations| { |locations| {
let mut ret = dc_array_t::new_locations(500); let mut ret = Vec::new();
for location in locations { for location in locations {
ret.add_location(location?); ret.push(location?);
} }
Ok(ret.into_raw()) Ok(dc_array_t::from(ret).into_raw())
}, },
) )
.unwrap_or_else(|_| std::ptr::null_mut()) .unwrap_or_else(|_| std::ptr::null_mut())