mirror of
https://github.com/esphome/esphome.git
synced 2026-09-11 23:37:34 +00:00
Merge remote-tracking branch 'origin/callback-manager-no-vector' into callback-manager-no-vector
This commit is contained in:
@@ -24,7 +24,7 @@ static const char *const TAG = "helpers";
|
||||
|
||||
__attribute__((noinline, cold)) void *callback_manager_grow(void *data, uint16_t size, uint16_t &capacity,
|
||||
size_t elem_size) {
|
||||
ESPHOME_DEBUG_ASSERT(size < UINT16_MAX - 1);
|
||||
ESPHOME_DEBUG_ASSERT(size < UINT16_MAX);
|
||||
uint16_t new_cap = size + 1;
|
||||
auto *new_data = ::operator new(new_cap *elem_size);
|
||||
if (data) {
|
||||
|
||||
@@ -1834,6 +1834,9 @@ template<typename... Ts> class CallbackManager<void(Ts...)> {
|
||||
|
||||
/// Call all callbacks in this manager.
|
||||
inline void ESPHOME_ALWAYS_INLINE call(Ts... args) {
|
||||
if (this->size_ == 0) {
|
||||
return;
|
||||
}
|
||||
for (auto *it = this->data_, *end = it + this->size_; it != end; ++it) {
|
||||
it->call(args...);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user