]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
pgsql: don't expose PgsqlTransactionState to C
authorJason Ish <jason.ish@oisf.net>
Mon, 26 Aug 2024 22:02:05 +0000 (16:02 -0600)
committerVictor Julien <victor@inliniac.net>
Sat, 31 Aug 2024 08:53:59 +0000 (10:53 +0200)
PgsqlTransactionState has a variant named "Init" which is a little too
generic to export to C. Fortunately this method doesn't need to be
exposed to C, instead remove it as it was only called by
rs_pgsql_tx_get_alstate_progress which also doesn't need to be public
or expose to C.

Ticket: #7227

rust/src/pgsql/pgsql.rs

index 1873be5a75322c64151be25238d7e7bfb08f7b49..105bdcdb12381ce69f10e84929067a2fe2e3572b 100644 (file)
@@ -705,20 +705,11 @@ pub extern "C" fn rs_pgsql_state_get_tx_count(state: *mut std::os::raw::c_void)
     return state_safe.tx_id;
 }
 
-#[no_mangle]
-pub extern "C" fn rs_pgsql_tx_get_state(tx: *mut std::os::raw::c_void) -> PgsqlTransactionState {
-    let tx_safe: &mut PgsqlTransaction;
-    unsafe {
-        tx_safe = cast_pointer!(tx, PgsqlTransaction);
-    }
-    return tx_safe.tx_state;
-}
-
-#[no_mangle]
-pub extern "C" fn rs_pgsql_tx_get_alstate_progress(
+unsafe extern "C" fn rs_pgsql_tx_get_alstate_progress(
     tx: *mut std::os::raw::c_void, _direction: u8,
 ) -> std::os::raw::c_int {
-    return rs_pgsql_tx_get_state(tx) as i32;
+    let tx = cast_pointer!(tx, PgsqlTransaction);
+    tx.tx_state as i32
 }
 
 export_tx_data_get!(rs_pgsql_get_tx_data, PgsqlTransaction);