Skip to content

Commit f5cf667

Browse files
classicrocker883thinkyhead
andauthoredMay 1, 2024··
🎨 Clarify some string parameters (#26949)
Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
1 parent 737095f commit f5cf667

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed
 

‎Marlin/src/core/mstring.h

+5-5
Original file line numberDiff line numberDiff line change
@@ -143,13 +143,13 @@ class MString {
143143

144144
// Set with format string and arguments, like printf
145145
template<typename... Args>
146-
MString& setf_P(PGM_P const fmt, Args... more) { SNPRINTF_P(str, SIZE, fmt, more...); debug(F("setf_P")); return *this; }
146+
MString& setf_P(PGM_P const pfmt, Args... more) { SNPRINTF_P(str, SIZE, pfmt, more...); debug(F("setf_P")); return *this; }
147147

148148
template<typename... Args>
149-
MString& setf(const char *fmt, Args... more) { SNPRINTF(str, SIZE, fmt, more...); debug(F("setf")); return *this; }
149+
MString& setf(const char *fmt, Args... more) { SNPRINTF(str, SIZE, fmt, more...); debug(F("setf")); return *this; }
150150

151151
template<typename... Args>
152-
MString& setf(FSTR_P const fmt, Args... more) { return setf_P(FTOP(fmt), more...); }
152+
MString& setf(FSTR_P const ffmt, Args... more) { return setf_P(FTOP(ffmt), more...); }
153153

154154
// Chainable String appenders
155155
MString& append() { debug(F("nil")); return *this; } // for macros that might emit no output
@@ -206,9 +206,9 @@ class MString {
206206
MString& append(const spaces_t &s) { return append(repchr_t(' ', s.count)); }
207207

208208
template<typename... Args>
209-
MString& appendf_P(PGM_P const fmt, Args... more) {
209+
MString& appendf_P(PGM_P const pfmt, Args... more) {
210210
int sz = length();
211-
if (sz < SIZE) SNPRINTF_P(str + sz, SIZE - sz, fmt, more...);
211+
if (sz < SIZE) SNPRINTF_P(str + sz, SIZE - sz, pfmt, more...);
212212
debug(F("appendf_P"));
213213
return *this;
214214
}

‎Marlin/src/core/serial.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -271,13 +271,13 @@ class SString : public MString<SIZE> {
271271
SString& set() { super::set(); return *this; }
272272

273273
template<typename... Args>
274-
SString& setf_P(PGM_P const fmt, Args... more) { super::setf_P(fmt, more...); return *this; }
274+
SString& setf_P(PGM_P const pfmt, Args... more) { super::setf_P(pfmt, more...); return *this; }
275275

276276
template<typename... Args>
277-
SString& setf(const char *fmt, Args... more) { super::setf(fmt, more...); return *this; }
277+
SString& setf(const char *fmt, Args... more) { super::setf(fmt, more...); return *this; }
278278

279279
template<typename... Args>
280-
SString& setf(FSTR_P const fmt, Args... more) { super::setf(fmt, more...); return *this; }
280+
SString& setf(FSTR_P const ffmt, Args... more) { super::setf(ffmt, more...); return *this; }
281281

282282
template <typename T>
283283
SString& set(const T &v) { super::set(v); return *this; }

‎Marlin/src/lcd/marlinui.cpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -1563,12 +1563,12 @@ void MarlinUI::host_notify(const char * const cstr) {
15631563
*
15641564
* @param pfmt A constant format P-string
15651565
*/
1566-
void MarlinUI::status_printf_P(int8_t level, PGM_P const fmt, ...) {
1566+
void MarlinUI::status_printf_P(int8_t level, PGM_P const pfmt, ...) {
15671567
if (set_alert_level(level)) return;
15681568

15691569
va_list args;
1570-
va_start(args, fmt);
1571-
vsnprintf_P(status_message, MAX_MESSAGE_LENGTH, fmt, args);
1570+
va_start(args, pfmt);
1571+
vsnprintf_P(status_message, MAX_MESSAGE_LENGTH, pfmt, args);
15721572
va_end(args);
15731573

15741574
host_notify(status_message);
@@ -1642,12 +1642,12 @@ void MarlinUI::host_notify(const char * const cstr) {
16421642
void MarlinUI::_set_status_and_level(const char * const ustr, const int8_t=0, const bool pgm) {
16431643
pgm ? host_notify_P(ustr) : host_notify(ustr);
16441644
}
1645-
void MarlinUI::status_printf_P(int8_t level, PGM_P const fmt, ...) {
1645+
void MarlinUI::status_printf_P(int8_t level, PGM_P const pfmt, ...) {
16461646
MString<30> msg;
16471647

16481648
va_list args;
1649-
va_start(args, fmt);
1650-
vsnprintf_P(&msg, 30, fmt, args);
1649+
va_start(args, pfmt);
1650+
vsnprintf_P(&msg, 30, pfmt, args);
16511651
va_end(args);
16521652

16531653
host_notify(msg);

0 commit comments

Comments
 (0)
Please sign in to comment.