mirror of
https://github.com/esphome/esphome.git
synced 2025-08-06 18:37:47 +00:00
tweak
This commit is contained in:
parent
0900fd3cea
commit
033c469250
@ -155,7 +155,15 @@ class Scheduler {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
const char *item_name = item->get_name();
|
const char *item_name = item->get_name();
|
||||||
return item_name != nullptr && strcmp(name_cstr, item_name) == 0;
|
if (item_name == nullptr) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
// Fast path: if pointers are equal (common with string deduplication)
|
||||||
|
if (item_name == name_cstr) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
// Slow path: compare string contents
|
||||||
|
return strcmp(name_cstr, item_name) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Helper to execute a scheduler item
|
// Helper to execute a scheduler item
|
||||||
|
Loading…
x
Reference in New Issue
Block a user