Skip to content

Commit

Permalink
Shorten unsafe block
Browse files Browse the repository at this point in the history
  • Loading branch information
bugadani committed Oct 25, 2023
1 parent 624f8f0 commit a829d22
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions esp-wifi/src/wifi/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1072,17 +1072,16 @@ pub fn esp_wifi_send_data(interface: wifi_interface_t, data: &mut [u8]) {
trace!("sending... {} bytes", data.len());
dump_packet_info(data);

unsafe {
let len = data.len() as u16;
let ptr = data.as_mut_ptr().cast();
let len = data.len() as u16;
let ptr = data.as_mut_ptr().cast();

let res = esp_wifi_internal_tx(interface, ptr, len);
if res != 0 {
warn!("esp_wifi_internal_tx {}", res);
decrement_inflight_counter();
} else {
trace!("esp_wifi_internal_tx ok");
}
let res = unsafe { esp_wifi_internal_tx(interface, ptr, len) };

if res != 0 {
warn!("esp_wifi_internal_tx {}", res);
decrement_inflight_counter();
} else {
trace!("esp_wifi_internal_tx ok");
}
}

Expand Down

0 comments on commit a829d22

Please sign in to comment.