@@ -77,7 +77,7 @@ def map_type_with_info(self, ty_info, print_void, ret_arr_len, is_free, holds_re
7777 #if ty_info.is_ptr or holds_ref:
7878 # ty_info.subty.requires_clone = False
7979 ty_info .subty .requires_clone = not ty_info .is_ptr or not holds_ref
80- if ty_info .subty .rust_obj is not None and ty_info .subty .rust_obj == "LDKChannelMonitor" :
80+ if not ty_info .subty .is_native_primitive and ty_info .subty .rust_obj == "LDKChannelMonitor" :
8181 # We take a Vec of references to ChannelMonitors as input to ChannelManagerReadArgs, if we clone them,
8282 # we end up freeing the clones after creating the ChannelManagerReadArgs before calling the read
8383 # function itself, resulting in a segfault. Thus, we manually check and ensure we don't clone for
@@ -89,7 +89,7 @@ def map_type_with_info(self, ty_info, print_void, ret_arr_len, is_free, holds_re
8989 arg_conv = ty_info .rust_obj + " " + arr_name + "_constr;\n "
9090 arg_conv = arg_conv + arr_name + "_constr." + arr_len + " = " + self .consts .get_native_arr_len_call [0 ] + arr_name + self .consts .get_native_arr_len_call [1 ] + ";\n "
9191 arg_conv = arg_conv + "if (" + arr_name + "_constr." + arr_len + " > 0)\n "
92- if subty .rust_obj is None :
92+ if subty .is_native_primitive :
9393 szof = subty .c_ty
9494 else :
9595 szof = subty .rust_obj
@@ -186,7 +186,7 @@ def map_type_with_info(self, ty_info, print_void, ret_arr_len, is_free, holds_re
186186 ret_conv_name = ty_info .var_name + "_conv" , to_hu_conv = None , to_hu_conv_name = None , from_hu_conv = None )
187187 elif ty_info .var_name == "" and not print_void :
188188 # We don't have a parameter name, and want one, just call it arg
189- if ty_info . rust_obj is not None :
189+ if not ty_info . is_native_primitive :
190190 assert (not is_free or ty_info .rust_obj not in self .opaque_structs )
191191 return ConvInfo (ty_info = ty_info , arg_name = ty_info .var_name ,
192192 arg_conv = ty_info .rust_obj + " arg_conv = *(" + ty_info .rust_obj + "*)arg;\n FREE((void*)arg);" ,
@@ -197,7 +197,7 @@ def map_type_with_info(self, ty_info, print_void, ret_arr_len, is_free, holds_re
197197 return ConvInfo (ty_info = ty_info , arg_name = ty_info .var_name ,
198198 arg_conv = None , arg_conv_name = "arg" , arg_conv_cleanup = None ,
199199 ret_conv = None , ret_conv_name = None , to_hu_conv = "TODO 8" , to_hu_conv_name = None , from_hu_conv = None )
200- elif ty_info .rust_obj is None :
200+ elif ty_info .is_native_primitive :
201201 return ConvInfo (ty_info = ty_info , arg_name = ty_info .var_name ,
202202 arg_conv = None , arg_conv_name = ty_info .var_name , arg_conv_cleanup = None ,
203203 ret_conv = None , ret_conv_name = None , to_hu_conv = None , to_hu_conv_name = None , from_hu_conv = None )
0 commit comments