mirror of
https://github.com/esphome/esphome.git
synced 2025-08-10 12:27:46 +00:00
dry
This commit is contained in:
@@ -86,11 +86,19 @@ class Scheduler {
|
|||||||
|
|
||||||
// Destructor to clean up dynamic names
|
// Destructor to clean up dynamic names
|
||||||
~SchedulerItem() {
|
~SchedulerItem() {
|
||||||
if (owns_name && name_.dynamic_name) {
|
if (owns_name) {
|
||||||
delete[] name_.dynamic_name;
|
delete[] name_.dynamic_name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Delete copy operations to prevent accidental copies
|
||||||
|
SchedulerItem(const SchedulerItem &) = delete;
|
||||||
|
SchedulerItem &operator=(const SchedulerItem &) = delete;
|
||||||
|
|
||||||
|
// Default move operations
|
||||||
|
SchedulerItem(SchedulerItem &&) = default;
|
||||||
|
SchedulerItem &operator=(SchedulerItem &&) = default;
|
||||||
|
|
||||||
// Helper to get the name regardless of storage type
|
// Helper to get the name regardless of storage type
|
||||||
const char *get_name() const { return owns_name ? name_.dynamic_name : name_.static_name; }
|
const char *get_name() const { return owns_name ? name_.dynamic_name : name_.static_name; }
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user