Update to new dependencies
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
use alloc::heap::{AllocErr, GlobalAlloc, Layout, Opaque};
|
||||
use core::alloc::{AllocErr, GlobalAlloc, Layout};
|
||||
use core::ptr::NonNull;
|
||||
use linked_list_allocator::Heap;
|
||||
use spin::Mutex;
|
||||
@@ -16,7 +16,7 @@ impl Allocator {
|
||||
}
|
||||
|
||||
unsafe impl GlobalAlloc for Allocator {
|
||||
unsafe fn alloc(&self, layout: Layout) -> *mut Opaque {
|
||||
unsafe fn alloc(&self, layout: Layout) -> *mut u8 {
|
||||
loop {
|
||||
let res = if let Some(ref mut heap) = *HEAP.lock() {
|
||||
heap.allocate_first_fit(layout)
|
||||
@@ -40,12 +40,12 @@ unsafe impl GlobalAlloc for Allocator {
|
||||
panic!("__rust_allocate: heap not initialized");
|
||||
}
|
||||
},
|
||||
other => return other.ok().map_or(0 as *mut Opaque, |allocation| allocation.as_ptr()),
|
||||
other => return other.ok().map_or(0 as *mut u8, |allocation| allocation.as_ptr()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
unsafe fn dealloc(&self, ptr: *mut Opaque, layout: Layout) {
|
||||
unsafe fn dealloc(&self, ptr: *mut u8, layout: Layout) {
|
||||
if let Some(ref mut heap) = *HEAP.lock() {
|
||||
heap.deallocate(NonNull::new_unchecked(ptr), layout)
|
||||
} else {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use alloc::heap::{Alloc, AllocErr, Layout};
|
||||
use core::alloc::{Alloc, AllocErr, Layout};
|
||||
use spin::Mutex;
|
||||
use slab_allocator::Heap;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user