Console: Eliminate redundant strlen call in commandExists()

By using the std::string_view constructor for std::string, we can avoid
the char* constructor, which would require a strlen call in order to
determine the string size. This also allows it to work with
non-null-terminated strings.
This commit is contained in:
Lioncash 2019-10-21 01:28:20 -04:00
parent 96721d96ae
commit deb09550d3
1 changed files with 1 additions and 1 deletions

View File

@ -168,7 +168,7 @@ void Console::listCommands(Console* /*con*/, const std::vector<std::string>& /*a
}
bool Console::commandExists(std::string_view cmd) {
std::string cmdName = cmd.data();
std::string cmdName{cmd};
athena::utility::tolower(cmdName);
return m_commands.find(cmdName) != m_commands.end();