From b19918cdbfbb87dafc05a12a2b33f6bd609f210b Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Mon, 5 Jan 2026 23:38:06 -1000 Subject: [PATCH] [debug] Use stack buffers with buf_append helper instead of std::string --- esphome/components/debug/debug_component.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/esphome/components/debug/debug_component.h b/esphome/components/debug/debug_component.h index 09f08a37ba..5783bc5418 100644 --- a/esphome/components/debug/debug_component.h +++ b/esphome/components/debug/debug_component.h @@ -28,7 +28,7 @@ static constexpr size_t RESET_REASON_BUFFER_SIZE = 128; #ifdef USE_ESP8266 // ESP8266: Use vsnprintf_P to keep format strings in flash (PROGMEM) // Format strings must be wrapped with PSTR() macro -inline size_t buf_append_P(char *buf, size_t size, size_t pos, PGM_P fmt, ...) { +inline size_t buf_append_p(char *buf, size_t size, size_t pos, PGM_P fmt, ...) { if (pos >= size) { return size; } @@ -41,7 +41,7 @@ inline size_t buf_append_P(char *buf, size_t size, size_t pos, PGM_P fmt, ...) { } return std::min(pos + static_cast(written), size); } -#define buf_append(buf, size, pos, fmt, ...) buf_append_P(buf, size, pos, PSTR(fmt), ##__VA_ARGS__) +#define buf_append(buf, size, pos, fmt, ...) buf_append_p(buf, size, pos, PSTR(fmt), ##__VA_ARGS__) #else /// Safely append formatted string to buffer, returning new position (capped at size) __attribute__((format(printf, 4, 5))) inline size_t buf_append(char *buf, size_t size, size_t pos, const char *fmt,