Revert "Use pointer-to-pointer idiom in add_action() for consistency"

This reverts commit db42403494.
This commit is contained in:
J. Nick Koston
2026-03-28 10:46:04 -10:00
parent db42403494
commit e3e5f40a96
+9 -5
View File
@@ -419,11 +419,15 @@ template<typename... Ts> class Action {
template<typename... Ts> class ActionList {
public:
void add_action(Action<Ts...> *action) {
// Walk to end of chain - action lists are short and only built during setup()
Action<Ts...> **tail = &this->actions_begin_;
while (*tail != nullptr)
tail = &(*tail)->next_;
*tail = action;
if (this->actions_begin_ == nullptr) {
this->actions_begin_ = action;
} else {
// Walk to end of chain - action lists are short and only built during setup()
auto *it = this->actions_begin_;
while (it->next_ != nullptr)
it = it->next_;
it->next_ = action;
}
}
void add_actions(const std::initializer_list<Action<Ts...> *> &actions) {
// Find tail once, then append all actions in a single pass