refactor: Add reserve size for commands

This commit is contained in:
Petr Mironychev
2025-11-25 23:33:52 +01:00
parent 07de415346
commit dc6ec4fb4f

View File

@ -226,9 +226,12 @@ QStringList ExecuteTerminalCommandTool::getAllowedCommands() const
return QStringList();
}
QStringList commands = commandsStr.split(',', Qt::SkipEmptyParts);
for (QString &cmd : commands) {
cmd = cmd.trimmed();
const QStringList rawCommands = commandsStr.split(',', Qt::SkipEmptyParts);
QStringList commands;
commands.reserve(rawCommands.size());
for (const QString &cmd : rawCommands) {
commands.append(cmd.trimmed());
}
return commands;