X-Git-Url: http://git.bitcoin.ninja/index.cgi?p=ldk-c-bindings;a=blobdiff_plain;f=lightning-c-bindings%2Fsrc%2Flightning%2Futil%2Fser.rs;fp=lightning-c-bindings%2Fsrc%2Flightning%2Futil%2Fser.rs;h=be7c62636cf114978f0cdfd87869fade48a182e6;hp=23890d863974dff8669b0e8c21b6ac3f0323eed7;hb=c809fde8131b3ffdb6e5c73709e85d918a87c87d;hpb=7d8ba6706e4a52744eeab9590fa1bfea1a6fc211 diff --git a/lightning-c-bindings/src/lightning/util/ser.rs b/lightning-c-bindings/src/lightning/util/ser.rs index 23890d8..be7c626 100644 --- a/lightning-c-bindings/src/lightning/util/ser.rs +++ b/lightning-c-bindings/src/lightning/util/ser.rs @@ -169,6 +169,15 @@ pub(crate) extern "C" fn Hostname_clone_void(this_ptr: *const c_void) -> *mut c_ pub extern "C" fn Hostname_clone(orig: &Hostname) -> Hostname { orig.clone() } +/// Checks if two Hostnames contain equal inner contents. +/// This ignores pointers and is_owned flags and looks at the values in fields. +/// Two objects with NULL inner values will be considered "equal" here. +#[no_mangle] +pub extern "C" fn Hostname_eq(a: &Hostname, b: &Hostname) -> bool { + if a.inner == b.inner { return true; } + if a.inner.is_null() || b.inner.is_null() { return false; } + if a.get_native_ref() == b.get_native_ref() { true } else { false } +} /// Returns the length of the hostname. #[must_use] #[no_mangle]