From b209fe7ebeb6d303f78eb226e4e9c235e924179f Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sat, 28 Mar 2026 10:46:36 -1000 Subject: [PATCH] Add comment explaining why add_action uses if/else instead of pointer-to-pointer --- esphome/core/automation.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/esphome/core/automation.h b/esphome/core/automation.h index 72bcc3d707..b41a3555e4 100644 --- a/esphome/core/automation.h +++ b/esphome/core/automation.h @@ -422,7 +422,8 @@ template class ActionList { if (this->actions_begin_ == nullptr) { this->actions_begin_ = action; } else { - // Walk to end of chain - action lists are short and only built during setup() + // Walk to end of chain - action lists are short and only built during setup(). + // Note: intentionally not using pointer-to-pointer idiom here as it generates larger code. auto *it = this->actions_begin_; while (it->next_ != nullptr) it = it->next_;