♻️ String helper class (#24390)

This commit is contained in:
Scott Lahteine 2023-06-27 13:19:36 -05:00 committed by GitHub
parent 4a734e4de4
commit 574dd34c49
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
36 changed files with 955 additions and 598 deletions

View file

@ -1173,10 +1173,7 @@ void GcodeSuite::process_subcommands_now(FSTR_P fgcode) {
for (;;) {
PGM_P const delim = strchr_P(pgcode, '\n'); // Get address of next newline
const size_t len = delim ? delim - pgcode : strlen_P(pgcode); // Get the command length
char cmd[len + 1]; // Allocate a stack buffer
strncpy_P(cmd, pgcode, len); // Copy the command to the stack
cmd[len] = '\0'; // End with a nul
parser.parse(cmd); // Parse the command
parser.parse(MString<MAX_CMD_SIZE>().setn_P(pgcode, len)); // Parse the command
process_parsed_command(true); // Process it (no "ok")
if (!delim) break; // Last command?
pgcode = delim + 1; // Get the next command