Lines Matching +full:non +full:- +full:core

1 // SPDX-License-Identifier: GPL-2.0
6 use core::alloc::{GlobalAlloc, Layout};
7 use core::ptr;
15 /// - `ptr` can be either null or a pointer which has been allocated by this allocator.
16 /// - `new_layout` must have a non-zero size.
17 pub(crate) unsafe fn krealloc_aligned(ptr: *mut u8, new_layout: Layout, flags: Flags) -> *mut u8 { in krealloc_aligned()
27 // - `ptr` is either null or a pointer returned from a previous `k{re}alloc()` by the in krealloc_aligned()
29 // - `size` is greater than 0 since it's from `layout.size()` (which cannot be zero according in krealloc_aligned()
31 unsafe { bindings::krealloc(ptr as *const core::ffi::c_void, size, flags.0) as *mut u8 } in krealloc_aligned() constant
35 unsafe fn alloc(&self, layout: Layout) -> *mut u8 { in alloc()
36 // SAFETY: `ptr::null_mut()` is null and `layout` has a non-zero size by the function safety in alloc()
43 bindings::kfree(ptr as *const core::ffi::c_void); in dealloc() constant
47 unsafe fn realloc(&self, ptr: *mut u8, layout: Layout, new_size: usize) -> *mut u8 { in realloc()
49 // - `new_size`, when rounded up to the nearest multiple of `layout.align()`, will not in realloc()
51 // - `layout.align()` is a proper alignment (i.e. not zero and must be a power of two). in realloc()
55 // - `ptr` is either null or a pointer allocated by this allocator by the function safety in realloc()
57 // - the size of `layout` is not zero because `new_size` is not zero by the function safety in realloc()
62 unsafe fn alloc_zeroed(&self, layout: Layout) -> *mut u8 { in alloc_zeroed()
63 // SAFETY: `ptr::null_mut()` is null and `layout` has a non-zero size by the function safety in alloc_zeroed()
72 // See <https://github.com/rust-lang/rust/pull/86844>.