mirror of
https://github.com/esphome/esphome.git
synced 2026-03-03 11:18:21 -07:00
avoid some conversion overhead
This commit is contained in:
@@ -2203,7 +2203,7 @@ bool WiFiScanResult::matches(const WiFiAP &config) const {
|
||||
return false;
|
||||
} else if (!config.get_ssid().empty()) {
|
||||
// check if SSID matches
|
||||
if (config.get_ssid() != this->ssid_.ref())
|
||||
if (this->ssid_ != config.get_ssid())
|
||||
return false;
|
||||
} else {
|
||||
// network is configured without SSID - match other settings
|
||||
@@ -2345,7 +2345,7 @@ void WiFiComponent::process_roaming_scan_() {
|
||||
|
||||
for (const auto &result : this->scan_result_) {
|
||||
// Must be same SSID, different BSSID
|
||||
if (result.get_ssid() != current_ssid.c_str() || result.get_bssid() == current_bssid)
|
||||
if (result.get_ssid() != current_ssid || result.get_bssid() == current_bssid)
|
||||
continue;
|
||||
|
||||
#if ESPHOME_LOG_LEVEL >= ESPHOME_LOG_LEVEL_VERBOSE
|
||||
|
||||
@@ -196,10 +196,10 @@ class CompactString {
|
||||
/// Return a StringRef view of this string (zero-copy)
|
||||
StringRef ref() const { return StringRef(this->data(), this->size()); }
|
||||
|
||||
bool operator==(const CompactString &other) const {
|
||||
return this->size() == other.size() && std::memcmp(this->data(), other.data(), this->size()) == 0;
|
||||
bool operator==(const StringRef &other) const {
|
||||
return this->size() == other.size() && std::memcmp(this->data(), other.c_str(), this->size()) == 0;
|
||||
}
|
||||
bool operator!=(const CompactString &other) const { return !(*this == other); }
|
||||
bool operator!=(const StringRef &other) const { return !(*this == other); }
|
||||
|
||||
protected:
|
||||
char *get_heap_ptr_() const {
|
||||
|
||||
Reference in New Issue
Block a user