🎨 Clarify some string parameters (#26949)

Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
This commit is contained in:
Andrew
2024-05-01 16:08:15 -04:00
committed by GitHub
parent 737095f852
commit f5cf667c95
3 changed files with 14 additions and 14 deletions

View File

@@ -143,13 +143,13 @@ public:
// Set with format string and arguments, like printf
template<typename... Args>
MString& setf_P(PGM_P const fmt, Args... more) { SNPRINTF_P(str, SIZE, fmt, more...); debug(F("setf_P")); return *this; }
MString& setf_P(PGM_P const pfmt, Args... more) { SNPRINTF_P(str, SIZE, pfmt, more...); debug(F("setf_P")); return *this; }
template<typename... Args>
MString& setf(const char *fmt, Args... more) { SNPRINTF(str, SIZE, fmt, more...); debug(F("setf")); return *this; }
template<typename... Args>
MString& setf(FSTR_P const fmt, Args... more) { return setf_P(FTOP(fmt), more...); }
MString& setf(FSTR_P const ffmt, Args... more) { return setf_P(FTOP(ffmt), more...); }
// Chainable String appenders
MString& append() { debug(F("nil")); return *this; } // for macros that might emit no output
@@ -206,9 +206,9 @@ public:
MString& append(const spaces_t &s) { return append(repchr_t(' ', s.count)); }
template<typename... Args>
MString& appendf_P(PGM_P const fmt, Args... more) {
MString& appendf_P(PGM_P const pfmt, Args... more) {
int sz = length();
if (sz < SIZE) SNPRINTF_P(str + sz, SIZE - sz, fmt, more...);
if (sz < SIZE) SNPRINTF_P(str + sz, SIZE - sz, pfmt, more...);
debug(F("appendf_P"));
return *this;
}

View File

@@ -271,13 +271,13 @@ public:
SString& set() { super::set(); return *this; }
template<typename... Args>
SString& setf_P(PGM_P const fmt, Args... more) { super::setf_P(fmt, more...); return *this; }
SString& setf_P(PGM_P const pfmt, Args... more) { super::setf_P(pfmt, more...); return *this; }
template<typename... Args>
SString& setf(const char *fmt, Args... more) { super::setf(fmt, more...); return *this; }
template<typename... Args>
SString& setf(FSTR_P const fmt, Args... more) { super::setf(fmt, more...); return *this; }
SString& setf(FSTR_P const ffmt, Args... more) { super::setf(ffmt, more...); return *this; }
template <typename T>
SString& set(const T &v) { super::set(v); return *this; }

View File

@@ -1563,12 +1563,12 @@ void MarlinUI::host_notify(const char * const cstr) {
*
* @param pfmt A constant format P-string
*/
void MarlinUI::status_printf_P(int8_t level, PGM_P const fmt, ...) {
void MarlinUI::status_printf_P(int8_t level, PGM_P const pfmt, ...) {
if (set_alert_level(level)) return;
va_list args;
va_start(args, fmt);
vsnprintf_P(status_message, MAX_MESSAGE_LENGTH, fmt, args);
va_start(args, pfmt);
vsnprintf_P(status_message, MAX_MESSAGE_LENGTH, pfmt, args);
va_end(args);
host_notify(status_message);
@@ -1642,12 +1642,12 @@ void MarlinUI::host_notify(const char * const cstr) {
void MarlinUI::_set_status_and_level(const char * const ustr, const int8_t=0, const bool pgm) {
pgm ? host_notify_P(ustr) : host_notify(ustr);
}
void MarlinUI::status_printf_P(int8_t level, PGM_P const fmt, ...) {
void MarlinUI::status_printf_P(int8_t level, PGM_P const pfmt, ...) {
MString<30> msg;
va_list args;
va_start(args, fmt);
vsnprintf_P(&msg, 30, fmt, args);
va_start(args, pfmt);
vsnprintf_P(&msg, 30, pfmt, args);
va_end(args);
host_notify(msg);