ui: remove unused buttons fields from data_t in trinary_choice
What changed, and why it matters
This commit is a small code cleanup in the user interface code of the BitBox02 hardware wallet. It removes three unused internal pointers that tracked on-screen buttons and instead uses temporary local variables. There is no functional change, no bug fix, and no security-relevant behavior change.
No security action needed. Treat as a normal refactoring commit.
Security signals we found
No strong security signals were identified.
Evidence from the diff
In src/ui/components/trinary_choice.c, the data_t struct previously stored component_t* pointers for button_left, button_middle, and button_right, but these fields were never read after creation. The patch removes those fields and assigns the button components to local stack variables inside trinary_choice_create(). The buttons are still created, added to the component tree, and positioned exactly as before. The diff is purely a refactor with no change to control flow, memory allocation, or user-visible behavior.
Changed components
src/ui/components/trinary_choice.cInspect captured patch +11 / −15
diff --git a/src/ui/components/trinary_choice.c b/src/ui/components/trinary_choice.c
index c13e437..357e678 100644
--- a/src/ui/components/trinary_choice.c
+++ b/src/ui/components/trinary_choice.c
@@ -25,9 +25,6 @@
typedef struct {
void (*chosen_cb)(trinary_choice_t, void* param);
void* chosen_cb_param;
- component_t* button_left;
- component_t* button_middle;
- component_t* button_right;
} data_t;
/**
@@ -95,24 +92,23 @@ component_t* trinary_choice_create(
ui_util_add_sub_component(component, label_create(message, NULL, CENTER, component));
}
- data->button_left = button_create(label_left, bottom_slider, 0, _left_selected, component);
- ui_util_add_sub_component(component, data->button_left);
+ component_t* button_left =
+ button_create(label_left, bottom_slider, 0, _left_selected, component);
+ ui_util_add_sub_component(component, button_left);
- data->button_middle =
+ component_t* button_middle =
button_create(label_middle, bottom_slider, 0, _middle_selected, component);
- ui_util_add_sub_component(component, data->button_middle);
+ ui_util_add_sub_component(component, button_middle);
- data->button_right = button_create(label_right, bottom_slider, 0, _right_selected, component);
- ui_util_add_sub_component(component, data->button_right);
+ component_t* button_right =
+ button_create(label_right, bottom_slider, 0, _right_selected, component);
+ ui_util_add_sub_component(component, button_right);
- ui_util_position_left_bottom_offset(component, data->button_left, 0, 0);
+ ui_util_position_left_bottom_offset(component, button_left, 0, 0);
ui_util_position_left_bottom_offset(
- component,
- data->button_middle,
- SCREEN_WIDTH / 2 - data->button_middle->dimension.width / 2,
- 0);
+ component, button_middle, SCREEN_WIDTH / 2 - button_middle->dimension.width / 2, 0);
ui_util_position_left_bottom_offset(
- component, data->button_right, SCREEN_WIDTH - data->button_right->dimension.width, 0);
+ component, button_right, SCREEN_WIDTH - button_right->dimension.width, 0);
return component;
}
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.