mirror of
https://github.com/chatmail/core.git
synced 2026-05-02 21:06:31 +03:00
Rename dc_array_new_typed into dc_array_new_locations
dc_array_new_typed is only used internally, so we can change its API.
This commit is contained in:
@@ -19,6 +19,14 @@ impl dc_array_t {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Constructs a new, empty `dc_array_t` holding locations with specified `capacity`.
|
||||||
|
pub fn new_locations(capacity: usize) -> Self {
|
||||||
|
dc_array_t {
|
||||||
|
type_0: DC_ARRAY_LOCATIONS,
|
||||||
|
array: Vec::with_capacity(capacity),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn as_ptr(self) -> *mut Self {
|
pub fn as_ptr(self) -> *mut Self {
|
||||||
Box::into_raw(Box::new(self))
|
Box::into_raw(Box::new(self))
|
||||||
}
|
}
|
||||||
@@ -255,10 +263,8 @@ pub fn dc_array_new(initsize: size_t) -> *mut dc_array_t {
|
|||||||
dc_array_t::new(initsize).as_ptr()
|
dc_array_t::new(initsize).as_ptr()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn dc_array_new_typed(type_0: libc::c_int, initsize: size_t) -> *mut dc_array_t {
|
pub fn dc_array_new_locations(initsize: size_t) -> *mut dc_array_t {
|
||||||
let mut array = dc_array_t::new(initsize);
|
dc_array_t::new_locations(initsize).as_ptr()
|
||||||
array.type_0 = type_0;
|
|
||||||
array.as_ptr()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub unsafe fn dc_array_empty(array: *mut dc_array_t) {
|
pub unsafe fn dc_array_empty(array: *mut dc_array_t) {
|
||||||
|
|||||||
@@ -247,7 +247,7 @@ pub fn dc_get_locations(
|
|||||||
Ok(loc)
|
Ok(loc)
|
||||||
},
|
},
|
||||||
|locations| {
|
|locations| {
|
||||||
let ret = dc_array_new_typed(1, 500);
|
let ret = dc_array_new_locations(500);
|
||||||
|
|
||||||
for location in locations {
|
for location in locations {
|
||||||
unsafe {
|
unsafe {
|
||||||
@@ -501,7 +501,7 @@ pub unsafe fn dc_kml_parse(
|
|||||||
} else {
|
} else {
|
||||||
content_nullterminated = dc_null_terminate(content, content_bytes as libc::c_int);
|
content_nullterminated = dc_null_terminate(content, content_bytes as libc::c_int);
|
||||||
if !content_nullterminated.is_null() {
|
if !content_nullterminated.is_null() {
|
||||||
kml.locations = dc_array_new_typed(1, 100 as size_t);
|
kml.locations = dc_array_new_locations(100);
|
||||||
dc_saxparser_init(
|
dc_saxparser_init(
|
||||||
&mut saxparser,
|
&mut saxparser,
|
||||||
&mut kml as *mut dc_kml_t as *mut libc::c_void,
|
&mut kml as *mut dc_kml_t as *mut libc::c_void,
|
||||||
|
|||||||
Reference in New Issue
Block a user