Skip to content

Commit

Permalink
codegen: Renaming some variables for clarity
Browse files Browse the repository at this point in the history
  • Loading branch information
C47D committed Jan 14, 2025
1 parent 52ad533 commit 5ca7262
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lvgl-codegen/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ impl Rusty for LvFunc {

// TODO Unsafe function for getters should be lvgl_sys::lv_bar_get_value(self.core.raw().as_ptr()) ?
// Currently they are lvgl_sys :: lv_bar_get_value (self . core . raw () . as_mut ()) }
let args_call = self
let ffi_args = self
.args
.iter()
.enumerate()
Expand All @@ -253,14 +253,14 @@ impl Rusty for LvFunc {

// NOTE: When the function returns something we can 'avoid' placing an Ok()
// at the end.
let return_ok_at_the_end = if return_type.is_empty() {
let explicit_ok = if return_type.is_empty() {
quote!(Ok(()))
} else {
quote!()
};

// And we can also return from the unsafe block by removing the ; at the end
let implicit_return = if has_return_value {
let optional_semicolon = if has_return_value {
quote!()
} else {
quote!(;)
Expand All @@ -270,10 +270,10 @@ impl Rusty for LvFunc {
pub fn #func_name(#args_decl) -> #return_type {
#args_processing
unsafe {
lvgl_sys::#original_func_name(#args_call)#implicit_return
lvgl_sys::#original_func_name(#ffi_args)#optional_semicolon
}

#return_ok_at_the_end
#explicit_ok
}
})
}
Expand Down

0 comments on commit 5ca7262

Please sign in to comment.