Skip to content

Commit 17b40fe

Browse files
bors[bot]phil-opp
andcommitted
Merge #16
16: Update to latest GlobalAlloc changes r=japaric a=phil-opp The `Opaque` type was removed and instead `u8` is used. Co-authored-by: Philipp Oppermann <dev@phil-opp.com>
2 parents 0529756 + 4535036 commit 17b40fe

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ extern crate alloc;
5454
extern crate cortex_m;
5555
extern crate linked_list_allocator;
5656

57-
use core::alloc::{GlobalAlloc, Layout, Opaque};
57+
use core::alloc::{GlobalAlloc, Layout};
5858
use core::ptr::NonNull;
5959

6060
use cortex_m::interrupt::Mutex;
@@ -104,14 +104,14 @@ impl CortexMHeap {
104104
}
105105

106106
unsafe impl GlobalAlloc for CortexMHeap {
107-
unsafe fn alloc(&self, layout: Layout) -> *mut Opaque {
107+
unsafe fn alloc(&self, layout: Layout) -> *mut u8 {
108108
self.heap
109109
.lock(|heap| heap.allocate_first_fit(layout))
110110
.ok()
111-
.map_or(0 as *mut Opaque, |allocation| allocation.as_ptr())
111+
.map_or(0 as *mut u8, |allocation| allocation.as_ptr())
112112
}
113113

114-
unsafe fn dealloc(&self, ptr: *mut Opaque, layout: Layout) {
114+
unsafe fn dealloc(&self, ptr: *mut u8, layout: Layout) {
115115
self.heap
116116
.lock(|heap| heap.deallocate(NonNull::new_unchecked(ptr), layout));
117117
}

0 commit comments

Comments
 (0)