Skip to content

Commit

Permalink
pgsql: don't expose PgsqlTransactionState to C
Browse files Browse the repository at this point in the history
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: OISF#7227
  • Loading branch information
jasonish authored and Corey Thomas committed Sep 3, 2024
1 parent 1e1a058 commit 6f6cfa6
Showing 1 changed file with 3 additions and 12 deletions.
15 changes: 3 additions & 12 deletions rust/src/pgsql/pgsql.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 6f6cfa6

Please sign in to comment.