File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -108,7 +108,12 @@ ERL_FUNCTION(listen_addr_strings)
108
108
109
109
uintptr_t handle = ListenAddrStrings (listen_addr );
110
110
111
- return get_handle_result (env , handle );
111
+ IF_ERROR (handle == 0 , "invalid handle returned" );
112
+ uintptr_t * obj = enif_alloc_resource (Option_type , sizeof (uintptr_t ));
113
+ IF_ERROR (obj == NULL , "couldn't create resource" );
114
+ * obj = handle ;
115
+ ERL_NIF_TERM term = enif_make_resource (env , obj );
116
+ return make_ok_tuple2 (env , term );
112
117
}
113
118
114
119
/****************/
@@ -125,7 +130,10 @@ ERL_FUNCTION(host_new)
125
130
while (!enif_is_empty_list (env , tail ) && i < MAX_OPTIONS )
126
131
{
127
132
enif_get_list_cell (env , tail , & head , & tail );
128
- options [i ++ ] = GET_HANDLE (head , "option" );
133
+ uintptr_t * obj ;
134
+ enif_get_resource (env , head , Option_type , (void * * )& obj );
135
+ IF_ERROR (obj == NULL , "invalid option" );
136
+ options [i ++ ] = * obj ;
129
137
}
130
138
GoSlice go_options = {options , i , MAX_OPTIONS };
131
139
uintptr_t result = HostNew (go_options );
You can’t perform that action at this time.
0 commit comments