1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-20 20:22:27 +01:00

[core] Make StringRef convertToJson inline to save 250+ bytes flash

This commit is contained in:
J. Nick Koston
2025-09-15 23:25:41 -05:00
parent 5fac67d195
commit 157ea2daa4
2 changed files with 1 additions and 13 deletions

View File

@@ -1,12 +0,0 @@
#include "string_ref.h"
namespace esphome {
#ifdef USE_JSON
// NOLINTNEXTLINE(readability-identifier-naming)
void convertToJson(const StringRef &src, JsonVariant dst) { dst.set(src.c_str()); }
#endif // USE_JSON
} // namespace esphome

View File

@@ -130,7 +130,7 @@ inline std::string operator+(const StringRef &lhs, const char *rhs) {
#ifdef USE_JSON
// NOLINTNEXTLINE(readability-identifier-naming)
void convertToJson(const StringRef &src, JsonVariant dst);
inline void convertToJson(const StringRef &src, JsonVariant dst) { dst.set(src.c_str()); }
#endif // USE_JSON
} // namespace esphome