Use library-configured allocator to free intermediate included ranges
This commit is contained in:
parent
1848d0bc36
commit
f0177f216e
2 changed files with 27 additions and 24 deletions
|
|
@ -768,8 +768,10 @@ impl Tree {
|
|||
let mut count = 0u32;
|
||||
unsafe {
|
||||
let ptr = ffi::ts_tree_included_ranges(self.0.as_ptr(), &mut count as *mut u32);
|
||||
let ranges = Vec::from_raw_parts(ptr, count as usize, count as usize);
|
||||
ranges.into_iter().map(|range| range.into()).collect()
|
||||
let ranges = slice::from_raw_parts(ptr, count as usize);
|
||||
let result = ranges.iter().copied().map(|range| range.into()).collect();
|
||||
(FREE_FN)(ptr as *mut c_void);
|
||||
result
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue