Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/table_collection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,10 @@ impl TableCollection {
Ok(tables)
}

fn new_uninit() -> Self {
Self::wrap()
}

pub(crate) fn into_raw(self) -> Result<*mut ll_bindings::tsk_table_collection_t, TskitError> {
let mut tables = self;
// rust won't let use move inner out b/c this type implements Drop.
Expand Down Expand Up @@ -1003,7 +1007,9 @@ impl TableCollection {

/// Return a "deep" copy of the tables.
pub fn deepcopy(&self) -> Result<TableCollection, TskitError> {
let mut copy = TableCollection::new(1.)?;
// The output is UNINITIALIZED tables,
// else we leak memory
let mut copy = Self::new_uninit();

let rv =
unsafe { ll_bindings::tsk_table_collection_copy(self.as_ptr(), copy.as_mut_ptr(), 0) };
Expand Down