more use of fmtlib and std::string

This commit is contained in:
Axel Kohlmeyer
2020-06-25 21:32:30 -04:00
parent 4816c5c7cc
commit e4a3a518f7
12 changed files with 94 additions and 162 deletions

View File

@ -227,11 +227,8 @@ void Input::file()
// execute the command
if (execute_command()) {
char *str = new char[maxline+32];
sprintf(str,"Unknown command: %s",line);
error->all(FLERR,str);
}
if (execute_command())
error->all(FLERR,fmt::format("Unknown command: {}",line));
}
}
@ -1249,7 +1246,7 @@ char *shell_failed_message(const char* cmd, int errnum)
const char *errmsg = strerror(errnum);
int len = strlen(cmd)+strlen(errmsg)+64;
char *msg = new char[len];
sprintf(msg,"Shell command '%s' failed with error '%s'", cmd, errmsg);
snprintf(msg, len, "Shell command '%s' failed with error '%s'", cmd, errmsg);
return msg;
}