From 82e58787c9abe46b5d6f5898f07455feabed65db Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Thu, 23 Sep 2021 22:40:47 +0000 Subject: [PATCH] Fix conflicting overuse of "ret" as a variable name --- gen_type_mapping.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gen_type_mapping.py b/gen_type_mapping.py index 4a8ac86c..bc3fb23a 100644 --- a/gen_type_mapping.py +++ b/gen_type_mapping.py @@ -297,7 +297,7 @@ class TypeMappingGenerator: ret_conv_name = ty_info.var_name + "_conv", to_hu_conv = None, to_hu_conv_name = None, from_hu_conv = None) base_conv = ty_info.rust_obj + " " + ty_info.var_name + "_conv = *(" + ty_info.rust_obj + "*)(((uint64_t)" + ty_info.var_name + ") & ~1);" if ty_info.rust_obj in self.trait_structs: - ret_conv = (ty_info.rust_obj + "* ret = MALLOC(sizeof(" + ty_info.rust_obj + "), \"" + ty_info.rust_obj + "\");\n*ret = ", ";") + ret_conv = (ty_info.rust_obj + "* " + ty_info.var_name + "_ret =MALLOC(sizeof(" + ty_info.rust_obj + "), \"" + ty_info.rust_obj + "\");\n*" + ty_info.var_name + "_ret = ", ";") if holds_ref: if (ty_info.rust_obj.replace("LDK", "") + "_clone") in self.clone_fns: ret_conv = (ret_conv[0] + ty_info.rust_obj.replace("LDK", "") + "_clone(&", ");") @@ -315,7 +315,7 @@ class TypeMappingGenerator: base_conv = base_conv + "\n" + "FREE((void*)" + ty_info.var_name + ");" return ConvInfo(ty_info = ty_info, arg_name = ty_info.var_name, arg_conv = base_conv, arg_conv_name = ty_info.var_name + "_conv", arg_conv_cleanup = None, - ret_conv = ret_conv, ret_conv_name = "(uint64_t)ret", + ret_conv = ret_conv, ret_conv_name = "(uint64_t)" + ty_info.var_name + "_ret", to_hu_conv = ty_info.java_hu_ty + " ret_hu_conv = new " + ty_info.java_hu_ty + "(null, " + ty_info.var_name + ");\nret_hu_conv.ptrs_to.add(this);", to_hu_conv_name = "ret_hu_conv", from_hu_conv = (ty_info.var_name + " == null ? 0 : " + ty_info.var_name + ".ptr", "this.ptrs_to.add(" + ty_info.var_name + ")")) -- 2.30.2