From 7b7a42b4675d6e803e97e007831bf0dc3a84e313 Mon Sep 17 00:00:00 2001 From: Wolfgang Bumiller Date: Fri, 15 Mar 2019 14:21:12 +0100 Subject: [PATCH] protocol: use Option 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 --- proxmox-protocol/src/c_client.rs | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/proxmox-protocol/src/c_client.rs b/proxmox-protocol/src/c_client.rs index cb8b9d92..ee0dc656 100644 --- a/proxmox-protocol/src/c_client.rs +++ b/proxmox-protocol/src/c_client.rs @@ -189,14 +189,8 @@ pub extern "C" fn proxmox_backup_new( opaque: *mut c_void, read: ReadFn, write: WriteFn, - drop: DropFn, + drop: Option, ) -> *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 { opaque, read,