mirror of https://github.com/AxioDL/metaforce.git
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:
parent
96721d96ae
commit
deb09550d3
|
@ -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();
|
||||
|
|
Loading…
Reference in New Issue