summaryrefslogtreecommitdiffstats
path: root/safe_libc/src/util.rs
blob: d37954cd031f21171aacde77bd30eab7270d4b75 (plain)
1
2
3
4
5
6
7
8
9
use alloc::alloc;

#[inline]
pub fn must_succeed<T>(p: *mut T) -> *mut T {
	if p.is_null() {
		alloc::handle_alloc_error(alloc::Layout::new::<T>())
	}
	p
}