mirror of
https://github.com/chatmail/core.git
synced 2026-04-17 21:46:35 +03:00
Move dc_array_unref logic inside dc_array_t implementation
This will allow to make dc_array_t members private in the future.
This commit is contained in:
@@ -47,6 +47,14 @@ impl dc_array_t {
|
||||
pub fn len(&self) -> usize {
|
||||
self.array.len()
|
||||
}
|
||||
|
||||
pub unsafe fn unref(&mut self) {
|
||||
if self.type_0 == DC_ARRAY_LOCATIONS {
|
||||
for &e in self.array.iter() {
|
||||
Box::from_raw(e as *mut dc_location);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -61,11 +69,6 @@ pub unsafe fn dc_array_unref(array: *mut dc_array_t) {
|
||||
if array.is_null() {
|
||||
return;
|
||||
}
|
||||
if (*array).type_0 == DC_ARRAY_LOCATIONS {
|
||||
for &e in (*array).array.iter() {
|
||||
Box::from_raw(e as *mut dc_location);
|
||||
}
|
||||
}
|
||||
Box::from_raw(array);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user