mirror of
https://github.com/esphome/esphome.git
synced 2025-09-19 19:52:20 +01:00
[core] Make StringRef convertToJson inline to save 250+ bytes flash (#10751)
This commit is contained in:
@@ -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
|
@@ -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
|
||||
|
Reference in New Issue
Block a user