mirror of
https://github.com/chatmail/core.git
synced 2026-05-19 23:06:32 +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 {
|
pub fn len(&self) -> usize {
|
||||||
self.array.len()
|
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() {
|
if array.is_null() {
|
||||||
return;
|
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);
|
Box::from_raw(array);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user