From a7bf93700111025326d07a7f30bb0941b0301641 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Tue, 8 Sep 2026 03:22:05 +0200 Subject: [PATCH] [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. --- esphome/core/string_ref.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/esphome/core/string_ref.h b/esphome/core/string_ref.h index b4b88c1f24..6f15f9da0c 100644 --- a/esphome/core/string_ref.h +++ b/esphome/core/string_ref.h @@ -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(base_); } operator std::string() const { return str(); }