protocol: use Option<fn()> for nullable function
This should have the same memory layoutas a simple `fn()` with NULL function pointers mapping to None. Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
parent
33b1767d05
commit
7b7a42b467
|
@ -189,14 +189,8 @@ pub extern "C" fn proxmox_backup_new(
|
||||||
opaque: *mut c_void,
|
opaque: *mut c_void,
|
||||||
read: ReadFn,
|
read: ReadFn,
|
||||||
write: WriteFn,
|
write: WriteFn,
|
||||||
drop: DropFn,
|
drop: Option<DropFn>,
|
||||||
) -> *mut CClient {
|
) -> *mut CClient {
|
||||||
let drop_ptr: *const () = unsafe { std::mem::transmute(drop) };
|
|
||||||
let drop = if drop_ptr.is_null() {
|
|
||||||
None
|
|
||||||
} else {
|
|
||||||
Some(drop)
|
|
||||||
};
|
|
||||||
make_c_client(crate::Client::new(CApiSocket {
|
make_c_client(crate::Client::new(CApiSocket {
|
||||||
opaque,
|
opaque,
|
||||||
read,
|
read,
|
||||||
|
|
Loading…
Reference in New Issue