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(); return QStringList();
} }
QStringList commands = commandsStr.split(',', Qt::SkipEmptyParts); const QStringList rawCommands = commandsStr.split(',', Qt::SkipEmptyParts);
for (QString &cmd : commands) { QStringList commands;
cmd = cmd.trimmed(); commands.reserve(rawCommands.size());
for (const QString &cmd : rawCommands) {
commands.append(cmd.trimmed());
} }
return commands; return commands;