Skip to content

Commit 25d281b

Browse files
committed
Use drop_boxed
1 parent e3d2c66 commit 25d281b

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

crates/duckdb/src/vtab/function.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use super::{
2+
drop_boxed,
23
ffi::{
34
duckdb_bind_add_result_column, duckdb_bind_get_extra_info, duckdb_bind_get_named_parameter,
45
duckdb_bind_get_parameter, duckdb_bind_get_parameter_count, duckdb_bind_info, duckdb_bind_set_bind_data,
@@ -18,11 +19,6 @@ use std::{
1819
os::raw::c_char,
1920
};
2021

21-
/// Callback function to drop extra info of type T
22-
unsafe extern "C" fn drop_extra_info<T>(ptr: *mut c_void) {
23-
drop(unsafe { Box::from_raw(ptr.cast::<T>()) });
24-
}
25-
2622
/// An interface to store and retrieve data during the function bind stage
2723
#[derive(Debug)]
2824
pub struct BindInfo {
@@ -338,7 +334,7 @@ impl TableFunction {
338334
unsafe {
339335
let boxed = Box::new(info);
340336
let ptr = Box::into_raw(boxed) as *mut c_void;
341-
self.set_extra_info(ptr, Some(drop_extra_info::<T>));
337+
self.set_extra_info(ptr, Some(drop_boxed::<T>));
342338
}
343339
self
344340
}

0 commit comments

Comments
 (0)