[core] Make StringRef convertToJson inline to save 250+ bytes flash (#10751)
This commit is contained in:
1 parent
28541bdb1c
commit
429e989b69
2 files changed
+1
-13
No files matched your search
@@ -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