From: Jason Ish Date: Mon, 26 Aug 2024 22:02:05 +0000 (-0600) Subject: pgsql: don't expose PgsqlTransactionState to C X-Git-Tag: suricata-8.0.0-beta1~925 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=080681aff5c86708fcd9a3b8efc2da355a0275f0;p=thirdparty%2Fsuricata.git pgsql: don't expose PgsqlTransactionState to C 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 --- diff --git a/rust/src/pgsql/pgsql.rs b/rust/src/pgsql/pgsql.rs index 1873be5a75..105bdcdb12 100644 --- a/rust/src/pgsql/pgsql.rs +++ b/rust/src/pgsql/pgsql.rs @@ -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);