Skip to content

Commit

Permalink
use Result::ok simplified ax_alloc
Browse files Browse the repository at this point in the history
  • Loading branch information
pymongo committed Aug 23, 2023
1 parent 0adc6ab commit 6357d60
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions api/arceos_api/src/imp/mem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,7 @@ cfg_alloc! {
use core::ptr::NonNull;

pub fn ax_alloc(layout: Layout) -> Option<NonNull<u8>> {
if let Ok(vaddr) = axalloc::global_allocator().alloc(layout) {
Some(vaddr)
} else {
None
}
axalloc::global_allocator().alloc(layout).ok()
}

pub fn ax_dealloc(ptr: NonNull<u8>, layout: Layout) {
Expand Down

0 comments on commit 6357d60

Please sign in to comment.