mirror of
https://github.com/bdwgc/bdwgc-rust.git
synced 2026-05-30 02:18:57 -06:00
Refactor (#250)
This commit is contained in:
20
src/lib.rs
20
src/lib.rs
@@ -28,11 +28,11 @@ extern "C" {
|
|||||||
fn GC_unregister_my_thread();
|
fn GC_unregister_my_thread();
|
||||||
fn GC_gcollect();
|
fn GC_gcollect();
|
||||||
fn GC_register_finalizer(
|
fn GC_register_finalizer(
|
||||||
obj: *const c_void,
|
ptr: *const c_void,
|
||||||
f: extern "C" fn(*mut c_void, *mut c_void),
|
finalizer: extern "C" fn(*mut c_void, *mut c_void),
|
||||||
client_data: *const c_void,
|
client_data: *const c_void,
|
||||||
opt_old_f: *const c_void,
|
opt_old_finalizer: *const c_void,
|
||||||
opt_old_cd: *const c_void,
|
opt_old_client_data: *const c_void,
|
||||||
) -> *mut c_void;
|
) -> *mut c_void;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -84,11 +84,17 @@ impl Allocator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub unsafe fn register_finalizer(
|
pub unsafe fn register_finalizer(
|
||||||
obj: *const c_void,
|
ptr: *const c_void,
|
||||||
f: extern "C" fn(*mut c_void, *mut c_void),
|
finalizer: extern "C" fn(*mut c_void, *mut c_void),
|
||||||
client_data: *const c_void,
|
client_data: *const c_void,
|
||||||
) {
|
) {
|
||||||
GC_register_finalizer(obj, f, client_data, std::ptr::null(), std::ptr::null());
|
GC_register_finalizer(
|
||||||
|
ptr,
|
||||||
|
finalizer,
|
||||||
|
client_data,
|
||||||
|
std::ptr::null(),
|
||||||
|
std::ptr::null(),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user