[debug] Use stack buffers with buf_append helper instead of std::string

This commit is contained in:
J. Nick Koston
2026-01-05 23:38:06 -10:00
parent 2288f8eb5e
commit b19918cdbf
+2 -2
View File
@@ -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<size_t>(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,