rust: fix clippy lint for null comparison

Use .is_null() instead of checking for equality against
std::ptr::null().
pull/7966/head
Jason Ish 3 years ago committed by Victor Julien
parent 45dfea2497
commit 2a42386c28

@ -134,10 +134,10 @@ impl Default for AppLayerTxData {
impl Drop for AppLayerTxData {
fn drop(&mut self) {
if self.de_state != std::ptr::null_mut() {
if !self.de_state.is_null() {
core::sc_detect_engine_state_free(self.de_state);
}
if self.events != std::ptr::null_mut() {
if !self.events.is_null() {
core::sc_app_layer_decoder_events_free_events(&mut self.events);
}
}

@ -732,7 +732,7 @@ pub unsafe extern "C" fn jb_set_string_from_bytes(
pub unsafe extern "C" fn jb_set_base64(
js: &mut JsonBuilder, key: *const c_char, bytes: *const u8, len: u32,
) -> bool {
if bytes == std::ptr::null() || len == 0 {
if bytes.is_null() || len == 0 {
return false;
}
if let Ok(key) = CStr::from_ptr(key).to_str() {
@ -746,7 +746,7 @@ pub unsafe extern "C" fn jb_set_base64(
pub unsafe extern "C" fn jb_set_hex(
js: &mut JsonBuilder, key: *const c_char, bytes: *const u8, len: u32,
) -> bool {
if bytes == std::ptr::null() || len == 0 {
if bytes.is_null() || len == 0 {
return false;
}
if let Ok(key) = CStr::from_ptr(key).to_str() {
@ -805,7 +805,7 @@ pub unsafe extern "C" fn jb_append_string_from_bytes(
pub unsafe extern "C" fn jb_append_base64(
js: &mut JsonBuilder, bytes: *const u8, len: u32,
) -> bool {
if bytes == std::ptr::null() || len == 0 {
if bytes.is_null() || len == 0 {
return false;
}
let val = std::slice::from_raw_parts(bytes, len as usize);

Loading…
Cancel
Save