Skip to content

Commit f42c46b

Browse files
Freax13nicholasbishop
authored andcommitted
use raw pointers instead of NonNull<T>
1 parent 7e3b5df commit f42c46b

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/proto/network/pxe.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
use core::{
44
ffi::c_void,
55
iter::from_fn,
6-
ptr::{null, null_mut, NonNull},
6+
ptr::{null, null_mut},
77
};
88

99
use bitflags::bitflags;
@@ -53,7 +53,7 @@ pub struct BaseCode {
5353
header_size: Option<&usize>,
5454
header_ptr: *const c_void,
5555
buffer_size: &usize,
56-
buffer_ptr: NonNull<c_void>,
56+
buffer_ptr: *const c_void,
5757
) -> Status,
5858
udp_read: unsafe extern "efiapi" fn(
5959
this: &Self,
@@ -65,7 +65,7 @@ pub struct BaseCode {
6565
header_size: Option<&usize>,
6666
header_ptr: *mut c_void,
6767
buffer_size: &mut usize,
68-
buffer_ptr: NonNull<c_void>,
68+
buffer_ptr: *mut c_void,
6969
) -> Status,
7070
set_ip_filter: extern "efiapi" fn(this: &Self, new_filter: &IpFilter) -> Status,
7171
arp: extern "efiapi" fn(
@@ -101,7 +101,7 @@ pub struct BaseCode {
101101
new_pxe_reply: Option<&Packet>,
102102
new_pxe_bis_reply: Option<&Packet>,
103103
) -> Status,
104-
mode: NonNull<Mode>,
104+
mode: *const Mode,
105105
}
106106

107107
impl BaseCode {
@@ -486,7 +486,7 @@ impl BaseCode {
486486
header_size,
487487
header_ptr,
488488
&buffer.len(),
489-
NonNull::from(&buffer[0]).cast(),
489+
(&buffer[0] as *const u8).cast(),
490490
)
491491
}
492492
.into()
@@ -525,7 +525,7 @@ impl BaseCode {
525525
header_size,
526526
header_ptr,
527527
&mut buffer_size,
528-
NonNull::from(&buffer[0]).cast(),
528+
(&mut buffer[0] as *mut u8).cast(),
529529
)
530530
};
531531
Result::from(status)?;
@@ -612,7 +612,7 @@ impl BaseCode {
612612

613613
/// Returns a reference to the `Mode` struct.
614614
pub fn mode(&self) -> &Mode {
615-
unsafe { self.mode.as_ref() }
615+
unsafe { &*self.mode }
616616
}
617617
}
618618

0 commit comments

Comments
 (0)