What changed, and why it matters
This commit is a routine code cleanup. It removes a placeholder 'do nothing' function called ui_util_on_event_noop and replaces its uses with NULL, because the user-interface system already allows the on_event handler to be NULL. There is no security-relevant change.
No security action needed; treat as normal refactoring.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch deletes the ui_util_on_event_noop no-op event handler from ui_util.c/ui_util.h and sets .on_event = NULL in 13 component function tables and one test fake. The commit message explicitly states ‘.on_event is allowed to be NULL’, confirming this is a pure refactoring that preserves behavior. No functional or security logic is modified.
Changed components
src/ui/ui_util.csrc/ui/ui_util.hsrc/ui/components/empty.csrc/ui/components/image.csrc/ui/components/info_centered.csrc/ui/components/knight_rider.csrc/ui/components/lockscreen.csrc/ui/components/orientation_arrows.csrc/ui/components/progress.csrc/ui/components/screensaver.csrc/ui/components/sdcard.csrc/ui/components/status.csrc/ui/components/trinary_choice.csrc/ui/components/waiting.ctest/hardware-fakes/src/fake_component.cInspect captured patch +13 / −32
diff --git a/src/ui/components/empty.c b/src/ui/components/empty.c
index 384960f..13b57ed 100644
--- a/src/ui/components/empty.c
+++ b/src/ui/components/empty.c
@@ -21,7 +21,7 @@
static const component_functions_t _component_functions = {
.cleanup = ui_util_component_cleanup,
.render = ui_util_component_render_subcomponents,
- .on_event = ui_util_on_event_noop,
+ .on_event = NULL,
};
/********************************** Create Instance **********************************/
diff --git a/src/ui/components/image.c b/src/ui/components/image.c
index 383593e..def3460 100644
--- a/src/ui/components/image.c
+++ b/src/ui/components/image.c
@@ -48,7 +48,7 @@ static void _render(component_t* component)
static const component_functions_t _component_functions = {
.cleanup = ui_util_component_cleanup,
.render = _render,
- .on_event = ui_util_on_event_noop,
+ .on_event = NULL,
};
/********************************** Create Instance **********************************/
diff --git a/src/ui/components/info_centered.c b/src/ui/components/info_centered.c
index ddd5e11..5e4f2c3 100644
--- a/src/ui/components/info_centered.c
+++ b/src/ui/components/info_centered.c
@@ -30,7 +30,7 @@
static const component_functions_t _component_functions = {
.cleanup = ui_util_component_cleanup,
.render = ui_util_component_render_subcomponents,
- .on_event = ui_util_on_event_noop,
+ .on_event = NULL,
};
/********************************** Create Instance **********************************/
diff --git a/src/ui/components/knight_rider.c b/src/ui/components/knight_rider.c
index 92d37fd..eeb8e57 100644
--- a/src/ui/components/knight_rider.c
+++ b/src/ui/components/knight_rider.c
@@ -50,7 +50,7 @@ static void _render(component_t* component)
static component_functions_t _component_functions = {
.cleanup = ui_util_component_cleanup,
.render = _render,
- .on_event = ui_util_on_event_noop,
+ .on_event = NULL,
};
/********************************** Create Instance **********************************/
diff --git a/src/ui/components/lockscreen.c b/src/ui/components/lockscreen.c
index 32f015a..42a32e6 100644
--- a/src/ui/components/lockscreen.c
+++ b/src/ui/components/lockscreen.c
@@ -31,7 +31,7 @@
static const component_functions_t _component_functions = {
.cleanup = ui_util_component_cleanup,
.render = ui_util_component_render_subcomponents,
- .on_event = ui_util_on_event_noop,
+ .on_event = NULL,
};
/********************************** Create Instance **********************************/
diff --git a/src/ui/components/orientation_arrows.c b/src/ui/components/orientation_arrows.c
index 5689f32..1de2038 100644
--- a/src/ui/components/orientation_arrows.c
+++ b/src/ui/components/orientation_arrows.c
@@ -142,7 +142,7 @@ static void _render(component_t* component)
static component_functions_t _component_functions = {
.cleanup = ui_util_component_cleanup,
.render = _render,
- .on_event = ui_util_on_event_noop,
+ .on_event = NULL,
};
/********************************** Create Instance **********************************/
diff --git a/src/ui/components/progress.c b/src/ui/components/progress.c
index fd0a2d0..9874593 100644
--- a/src/ui/components/progress.c
+++ b/src/ui/components/progress.c
@@ -38,7 +38,7 @@ static void _render(component_t* component)
static const component_functions_t _component_functions = {
.cleanup = ui_util_component_cleanup,
.render = _render,
- .on_event = ui_util_on_event_noop,
+ .on_event = NULL,
};
component_t* progress_create(const char* title)
diff --git a/src/ui/components/screensaver.c b/src/ui/components/screensaver.c
index d3dd32a..7f0eb80 100644
--- a/src/ui/components/screensaver.c
+++ b/src/ui/components/screensaver.c
@@ -71,7 +71,7 @@ static void _render(component_t* component)
static component_functions_t _component_functions = {
.cleanup = ui_util_component_cleanup,
.render = _render,
- .on_event = ui_util_on_event_noop,
+ .on_event = NULL,
};
component_t* screensaver_create(void)
diff --git a/src/ui/components/sdcard.c b/src/ui/components/sdcard.c
index 0dc7b04..2df6c54 100644
--- a/src/ui/components/sdcard.c
+++ b/src/ui/components/sdcard.c
@@ -59,7 +59,7 @@ static void _render(component_t* component)
static const component_functions_t _component_functions = {
.cleanup = ui_util_component_cleanup,
.render = _render,
- .on_event = ui_util_on_event_noop,
+ .on_event = NULL,
};
/********************************** Create Instance **********************************/
diff --git a/src/ui/components/status.c b/src/ui/components/status.c
index 962d753..d7ce208 100644
--- a/src/ui/components/status.c
+++ b/src/ui/components/status.c
@@ -55,7 +55,7 @@ static void _render(component_t* component)
static const component_functions_t _component_functions = {
.cleanup = ui_util_component_cleanup,
.render = _render,
- .on_event = ui_util_on_event_noop,
+ .on_event = NULL,
};
/********************************** Create Instance **********************************/
diff --git a/src/ui/components/trinary_choice.c b/src/ui/components/trinary_choice.c
index 88d65cb..d071f3b 100644
--- a/src/ui/components/trinary_choice.c
+++ b/src/ui/components/trinary_choice.c
@@ -33,7 +33,7 @@ typedef struct {
static const component_functions_t _component_functions = {
.cleanup = ui_util_component_cleanup,
.render = ui_util_component_render_subcomponents,
- .on_event = ui_util_on_event_noop,
+ .on_event = NULL,
};
static void _left_selected(component_t* button)
diff --git a/src/ui/components/waiting.c b/src/ui/components/waiting.c
index d284f4d..88b7513 100644
--- a/src/ui/components/waiting.c
+++ b/src/ui/components/waiting.c
@@ -37,7 +37,7 @@ static void _render(component_t* component)
static component_functions_t _component_functions = {
.cleanup = ui_util_component_cleanup,
.render = _render,
- .on_event = ui_util_on_event_noop,
+ .on_event = NULL,
};
/********************************** Create Instance **********************************/
diff --git a/src/ui/ui_util.c b/src/ui/ui_util.c
index 1e9f97f..e312ba9 100644
--- a/src/ui/ui_util.c
+++ b/src/ui/ui_util.c
@@ -63,18 +63,6 @@ void ui_util_component_cleanup(component_t* component)
free(component);
}
-/**
- * A no-op function for components that do not handle events.
- * @param[in] event The emitted event.
- * @param[in] component The component that receives the event.
- */
-void ui_util_on_event_noop(const event_t* event, component_t* component)
-{
- // noop
- (void)event;
- (void)component;
-}
-
/**
* Positions the child component in the center (vertical and horizontal) of the
* parent component.
diff --git a/src/ui/ui_util.h b/src/ui/ui_util.h
index 6baba90..09b4206 100644
--- a/src/ui/ui_util.h
+++ b/src/ui/ui_util.h
@@ -53,13 +53,6 @@ void ui_util_component_render_subcomponents(component_t* component);
*/
void ui_util_component_cleanup(component_t* component);
-/**
- * A no-op function for components that do not handle events.
- * @param[in] event The emitted event.
- * @param[in] component The component that receives the event.
- */
-void ui_util_on_event_noop(const event_t* event, component_t* component);
-
/**
* Positions the child component in the center (vertical and horizontal) of the
* parent component.
diff --git a/test/hardware-fakes/src/fake_component.c b/test/hardware-fakes/src/fake_component.c
index faf4909..a0ad383 100644
--- a/test/hardware-fakes/src/fake_component.c
+++ b/test/hardware-fakes/src/fake_component.c
@@ -28,7 +28,7 @@
static const component_functions_t FAKE_COMPONENT_FUNCTIONS = {
.cleanup = ui_util_component_cleanup,
.render = ui_util_component_render_subcomponents,
- .on_event = ui_util_on_event_noop};
+ .on_event = NULL};
/********************************** Create Instance **********************************/
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.