mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-12-11 22:22:37 +00:00
Migration to Edition 2024
This commit is contained in:
@@ -16,20 +16,24 @@ pub fn errno() -> &'static mut i32 {
|
||||
// When len is 0, don't care whether buf is null or not
|
||||
#[inline]
|
||||
pub unsafe fn slice_from_ptr<'a, T>(buf: *const T, len: usize) -> &'a [T] {
|
||||
if len == 0 {
|
||||
&[]
|
||||
} else {
|
||||
slice::from_raw_parts(buf, len)
|
||||
unsafe {
|
||||
if len == 0 {
|
||||
&[]
|
||||
} else {
|
||||
slice::from_raw_parts(buf, len)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// When len is 0, don't care whether buf is null or not
|
||||
#[inline]
|
||||
pub unsafe fn slice_from_ptr_mut<'a, T>(buf: *mut T, len: usize) -> &'a mut [T] {
|
||||
if len == 0 {
|
||||
&mut []
|
||||
} else {
|
||||
slice::from_raw_parts_mut(buf, len)
|
||||
unsafe {
|
||||
if len == 0 {
|
||||
&mut []
|
||||
} else {
|
||||
slice::from_raw_parts_mut(buf, len)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user