]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
rust: fix clippy warnings for unspecified extern ABI
authorJason Ish <jason.ish@oisf.net>
Wed, 9 Apr 2025 16:45:50 +0000 (10:45 -0600)
committerJason Ish <jason.ish@oisf.net>
Wed, 9 Apr 2025 17:12:55 +0000 (11:12 -0600)
Fix done by clippy --fix.

Ticket: #7652

rust/src/applayer.rs
rust/src/conf.rs
rust/src/core.rs
rust/src/filecontainer.rs
rust/src/frames.rs
rust/src/lua.rs

index 023d169585caa18a2987b17013e6957190022663..da36b6cf04692831c28055a35fa73d776ed88085 100644 (file)
@@ -475,7 +475,7 @@ pub type GetFrameNameById = unsafe extern "C" fn(u8) -> *const c_char;
 
 // Defined in app-layer-register.h
 /// cbindgen:ignore
-extern {
+extern "C" {
     pub fn AppLayerRegisterProtocolDetection(parser: *const RustParser, enable_default: c_int) -> AppProto;
     pub fn AppLayerRegisterParserAlias(parser_name: *const c_char, alias_name: *const c_char);
 }
@@ -487,7 +487,7 @@ pub unsafe fn AppLayerRegisterParser(parser: *const RustParser, alproto: AppProt
 
 // Defined in app-layer-detect-proto.h
 /// cbindgen:ignore
-extern {
+extern "C" {
     pub fn AppLayerProtoDetectPPRegister(ipproto: u8, portstr: *const c_char, alproto: AppProto,
                                          min_depth: u16, max_depth: u16, dir: u8,
                                          pparser1: ProbeFn, pparser2: ProbeFn);
@@ -522,7 +522,7 @@ pub const APP_LAYER_PARSER_OPT_ACCEPT_GAPS: u32 = BIT_U32!(0);
 pub const APP_LAYER_TX_SKIP_INSPECT_FLAG: u64 = BIT_U64!(62);
 
 /// cbindgen:ignore
-extern {
+extern "C" {
     pub fn AppLayerParserStateSetFlag(state: *mut c_void, flag: u16);
     pub fn AppLayerParserStateIssetFlag(state: *mut c_void, flag: u16) -> u16;
     pub fn AppLayerParserSetStreamDepth(ipproto: u8, alproto: AppProto, stream_depth: u32);
index 50cc07257009938dce64e13521ed1ef20b976150..9ef58747ebf09542793d25dd982c171e4466d0bf 100644 (file)
@@ -32,7 +32,7 @@ use nom7::{
 };
 
 /// cbindgen:ignore
-extern {
+extern "C" {
     fn ConfGet(key: *const c_char, res: *mut *const c_char) -> i8;
     fn ConfGetChildValue(conf: *const c_void, key: *const c_char,
                          vptr: *mut *const c_char) -> i8;
@@ -141,7 +141,6 @@ impl ConfNode {
         }
         return false;
     }
-
 }
 
 const BYTE: u64       = 1;
index 61d391e11bbb6cb05b5a15b368901290b3fe77e1..be164e67341a7a69d29dec0ccdc229f7955dcea5 100644 (file)
@@ -129,7 +129,7 @@ pub const FLOW_DIR_REVERSED: u32 = BIT_U32!(26);
 
 // Defined in app-layer-protos.h
 /// cbindgen:ignore
-extern {
+extern "C" {
     pub fn StringToAppProto(proto_name: *const u8) -> AppProto;
 }
 
@@ -224,7 +224,7 @@ pub struct SuricataContext {
     pub FileAppendGAP: SCFileAppendGAPById,
     pub FileContainerRecycle: SCFileContainerRecycle,
 
-    pub AppLayerRegisterParser: extern fn(parser: *const crate::applayer::RustParser, alproto: AppProto) -> std::os::raw::c_int,
+    pub AppLayerRegisterParser: extern "C" fn(parser: *const crate::applayer::RustParser, alproto: AppProto) -> std::os::raw::c_int,
 }
 
 #[allow(non_snake_case)]
@@ -234,7 +234,7 @@ pub struct SuricataFileContext {
 }
 
 /// cbindgen:ignore
-extern {
+extern "C" {
     pub fn SCGetContext() -> &'static mut SuricataContext;
     pub fn SCLogGetLogLevel() -> i32;
 }
@@ -301,7 +301,7 @@ pub enum Flow {}
 
 // Extern functions operating on Flow.
 /// cbindgen:ignore
-extern {
+extern "C" {
     pub fn FlowGetLastTimeAsParts(flow: &Flow, secs: *mut u64, usecs: *mut u64);
     pub fn FlowGetFlags(flow: &Flow) -> u32;
     pub fn FlowGetSourcePort(flow: &Flow) -> u16;
index 28d10cf05cf200aab2ea1f2c435951dddffb7e1a..2db0b40cc6bb787967a03e6df8e0c552c1ae6b76 100644 (file)
@@ -24,7 +24,7 @@ use crate::core::*;
 
 // Defined in util-file.h
 /// cbindgen:ignore
-extern {
+extern "C" {
     pub fn FileFlowFlagsToFlags(flow_file_flags: u16, flags: u8) -> u16;
 }
 
index 3496caa69428f434e31601eed84c5362adf9f4a9..b1208daddbd2a9400b578f648f39daf9a9572eee 100644 (file)
@@ -31,7 +31,7 @@ struct CFrame {
 
 // Defined in app-layer-register.h
 /// cbindgen:ignore
-extern {
+extern "C" {
     #[cfg(not(test))]
     fn AppLayerFrameNewByRelativeOffset(
         flow: *const Flow, stream_slice: *const StreamSlice, frame_start_rel: u32, len: i64,
index a8cfc7417518cccc37001e85b4b44fea0866f59b..2f5ddc4ff92aa4ba46566ec66c884aa3784200e0 100644 (file)
@@ -31,7 +31,7 @@ type LuaInteger = i32;
 pub enum CLuaState {}
 
 /// cbindgen:ignore
-extern {
+extern "C" {
     fn lua_createtable(lua: *mut CLuaState, narr: c_int, nrec: c_int);
     fn lua_settable(lua: *mut CLuaState, idx: c_long);
     fn lua_pushlstring(lua: *mut CLuaState, s: *const c_char, len: usize);