mirror of
https://github.com/esphome/esphome.git
synced 2026-09-11 15:27:33 +00:00
[core] Keep StringRef::str() inline
The std::string range constructor reads nothing for a zero length, so the guard only pushed str() out of line; the memcmp guards stay.
This commit is contained in:
@@ -96,7 +96,7 @@ class StringRef {
|
||||
return actual;
|
||||
}
|
||||
|
||||
std::string str() const { return len_ == 0 ? std::string() : std::string(base_, len_); }
|
||||
std::string str() const { return std::string(base_, len_); } // fine for {nullptr, 0}: nothing is read
|
||||
const uint8_t *byte() const { return reinterpret_cast<const uint8_t *>(base_); }
|
||||
|
||||
operator std::string() const { return str(); }
|
||||
|
||||
Reference in New Issue
Block a user