Skip to content

Commit

Permalink
replace typedef with using
Browse files Browse the repository at this point in the history
  • Loading branch information
DenisBiryukov91 committed Sep 2, 2024
1 parent f24801a commit d6eecef
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1619,7 +1619,7 @@ pub fn generate_generic_recv_cpp(macro_func: &[FunctionSignature]) -> String {
pub fn generate_generic_closure_cpp(macro_func: &[FunctionSignature]) -> String {
let mut out = "".to_owned();

out += "extern \"C\" typedef void (*z_closure_drop_callback_t)(void*);\n";
out += "extern \"C\" using z_closure_drop_callback_t = void(void*);\n";
for func in macro_func {
let return_type = &func.return_type.typename;
let closure_name = &func.args[0].name;
Expand All @@ -1639,11 +1639,11 @@ pub fn generate_generic_closure_cpp(macro_func: &[FunctionSignature]) -> String
.replace("_loaned", "");
out += "\n";
out += &format!(
"extern \"C\" typedef {return_type} (*{callback_type})({arg_type}, void*);
"extern \"C\" using {callback_type} = {return_type}({arg_type}, void*);
inline void z_closure(
{closure_type} {closure_name},
{callback_type} call,
z_closure_drop_callback_t drop,
{callback_type}* call,
z_closure_drop_callback_t* drop,
void *context) {{
{closure_name}->context = context;
{closure_name}->drop = drop;
Expand Down

0 comments on commit d6eecef

Please sign in to comment.