X-Git-Url: http://git.bitcoin.ninja/index.cgi?p=ldk-c-bindings;a=blobdiff_plain;f=lightning-c-bindings%2Fsrc%2Flightning%2Futil%2Fpersist.rs;fp=lightning-c-bindings%2Fsrc%2Flightning%2Futil%2Fpersist.rs;h=f962c982fcdc23037624fbd8e05d49877a1a974c;hp=953ffe8e68f5ba252da470a89fbd3dbba0e12687;hb=5502fccd64611f16f5ebba3759c68b1a4d69b537;hpb=1ec49fac7433e5b8693c3858a3e25998bc888eeb diff --git a/lightning-c-bindings/src/lightning/util/persist.rs b/lightning-c-bindings/src/lightning/util/persist.rs index 953ffe8..f962c98 100644 --- a/lightning-c-bindings/src/lightning/util/persist.rs +++ b/lightning-c-bindings/src/lightning/util/persist.rs @@ -90,6 +90,7 @@ pub struct KVStore { } unsafe impl Send for KVStore {} unsafe impl Sync for KVStore {} +#[allow(unused)] pub(crate) fn KVStore_clone_fields(orig: &KVStore) -> KVStore { KVStore { this_arg: orig.this_arg, @@ -167,6 +168,7 @@ pub struct Persister { } unsafe impl Send for Persister {} unsafe impl Sync for Persister {} +#[allow(unused)] pub(crate) fn Persister_clone_fields(orig: &Persister) -> Persister { Persister { this_arg: orig.this_arg, @@ -436,10 +438,10 @@ pub extern "C" fn MonitorUpdatingPersister_cleanup_stale_updates(this_arg: &crat impl From for crate::lightning::chain::chainmonitor::Persist { fn from(obj: nativeMonitorUpdatingPersister) -> Self { - let mut rust_obj = MonitorUpdatingPersister { inner: ObjOps::heap_alloc(obj), is_owned: true }; + let rust_obj = crate::lightning::util::persist::MonitorUpdatingPersister { inner: ObjOps::heap_alloc(obj), is_owned: true }; let mut ret = MonitorUpdatingPersister_as_Persist(&rust_obj); - // We want to free rust_obj when ret gets drop()'d, not rust_obj, so wipe rust_obj's pointer and set ret's free() fn - rust_obj.inner = core::ptr::null_mut(); + // We want to free rust_obj when ret gets drop()'d, not rust_obj, so forget it and set ret's free() fn + core::mem::forget(rust_obj); ret.free = Some(MonitorUpdatingPersister_free_void); ret }