Use LinkedListAllocator::lock instead of self.inner.lock()

This commit is contained in:
Philipp Oppermann
2020-01-30 13:03:34 +01:00
parent 0f74db4812
commit 00fedc801e

View File

@@ -122,7 +122,7 @@ unsafe impl GlobalAlloc for Locked<LinkedListAllocator> {
unsafe fn alloc(&self, layout: Layout) -> *mut u8 {
// perform layout adjustments
let (size, align) = LinkedListAllocator::size_align(layout);
let mut allocator = self.inner.lock();
let mut allocator = self.lock();
if let Some((region, alloc_start)) = allocator.find_region(size, align) {
let alloc_end = alloc_start.checked_add(size).expect("overflow");
@@ -140,6 +140,6 @@ unsafe impl GlobalAlloc for Locked<LinkedListAllocator> {
// perform layout adjustments
let (size, _) = LinkedListAllocator::size_align(layout);
self.inner.lock().add_free_region(ptr as usize, size)
self.lock().add_free_region(ptr as usize, size)
}
}