X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=genbindings.py;fp=genbindings.py;h=b8e58bc5b0e24a20c1e51a909b52965042650cb7;hb=096b386b1bb6d440d80de4ea528ccfb58305b9e4;hp=7ff9069b25d36b8ec0109e1a0dd7af1d36ccff6d;hpb=13cdf8bde340072288b39a5e29f0946d3e095ad4;p=ldk-java diff --git a/genbindings.py b/genbindings.py index 7ff9069b..b8e58bc5 100755 --- a/genbindings.py +++ b/genbindings.py @@ -816,7 +816,13 @@ with open(sys.argv[1]) as in_h, open(f"{sys.argv[2]}/bindings{consts.file_ext}", owned_fn_defn = field_decl + " " + struct_name.replace("LDK", "") + "_get_" + field_name + "(" + struct_name + " *NONNULL_PTR owner)" holds_ref = False - if field_ty.rust_obj is not None and field_ty.rust_obj.replace("LDK", "") + "_clone" in clone_fns: + if field_ty.rust_obj is not None and field_ty.rust_obj in opaque_structs: + fn_defn = owned_fn_defn + write_c("static inline " + fn_defn + "{\n") + write_c("\t" + field_ty.rust_obj + " ret = " + accessor[0] + "owner" + accessor[1] + ";\n") + write_c("\tret.is_owned = false;\n") + write_c("\treturn ret;\n") + elif field_ty.rust_obj is not None and field_ty.rust_obj.replace("LDK", "") + "_clone" in clone_fns: fn_defn = owned_fn_defn write_c("static inline " + fn_defn + "{\n") if check_sfx is not None: