From 9400a51c1baa9acaf604660950ff10aa6c33c1eb Mon Sep 17 00:00:00 2001 From: Martin Pool Date: Sat, 21 Dec 2024 10:43:19 -0800 Subject: [PATCH] Add unsafe blocks, rm unnecessary cast --- crates/duckdb/src/vtab/function.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/crates/duckdb/src/vtab/function.rs b/crates/duckdb/src/vtab/function.rs index 276610cc..cb32ee77 100644 --- a/crates/duckdb/src/vtab/function.rs +++ b/crates/duckdb/src/vtab/function.rs @@ -139,7 +139,9 @@ impl From for InitInfo { impl InitInfo { /// # Safety pub unsafe fn set_init_data(&self, data: *mut c_void, freeer: Option) { - duckdb_init_set_init_data(self.0, data, freeer); + unsafe { + duckdb_init_set_init_data(self.0, data, freeer); + } } /// Returns the column indices of the projected columns at the specified positions. @@ -189,7 +191,7 @@ impl InitInfo { /// * `error`: The error message pub fn set_error(&self, error: &str) { let c_str = CString::new(error).unwrap(); - unsafe { duckdb_init_set_error(self.0, c_str.as_ptr() as *const c_char) } + unsafe { duckdb_init_set_error(self.0, c_str.as_ptr()) } } } @@ -310,7 +312,9 @@ impl TableFunction { /// /// # Safety pub unsafe fn set_extra_info(&self, extra_info: *mut c_void, destroy: duckdb_delete_callback_t) { - duckdb_table_function_set_extra_info(self.ptr, extra_info, destroy); + unsafe { + duckdb_table_function_set_extra_info(self.ptr, extra_info, destroy); + } } /// Sets the thread-local init function of the table function