Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Use reserve() before appending with known size

parent d9efcd2e
......@@ -95,6 +95,7 @@ void KDevelopSessions::loadSessions()
// Switch kdevelop session: -u
// Should we add a match for this option or would that clutter the matches too much?
const QStringList list = findSessions();
m_sessions.reserve(list.size());
foreach (const QString &sessionfile, list)
{
Session session;
......
......@@ -370,6 +370,7 @@ QList<Variable*> Locals::updateLocals(QStringList locals)
// Variables that changed type -- likewise.
QList<Variable*> ret;
ret.reserve(childItems.size());
foreach (TreeItem *i, childItems) {
Q_ASSERT(qobject_cast<Variable*>(i));
ret << static_cast<Variable*>(i);
......
......@@ -227,6 +227,7 @@ void ClassModel::nodesLayoutChanged(ClassModelNodes::Node*)
QModelIndexList oldIndexList = persistentIndexList();
QModelIndexList newIndexList;
newIndexList.reserve(oldIndexList.size());
foreach(const QModelIndex& oldIndex, oldIndexList)
{
Node* node = static_cast<Node*>(oldIndex.internalPointer());
......
......@@ -34,6 +34,7 @@ namespace KDevelop {
struct CodeCompletionItemLastGrouper {
CodeCompletionItemLastGrouper(QList<QExplicitlySharedDataPointer<CompletionTreeElement> >& tree, CompletionTreeNode* parent, QList<CompletionTreeItemPointer> items)
{
tree.reserve(tree.size() + items.size());
foreach( CompletionTreeItemPointer item, items ) {
item->setParent(parent);
tree << QExplicitlySharedDataPointer<CompletionTreeElement>( item.data() );
......@@ -60,6 +61,7 @@ struct CodeCompletionItemGrouper {
(*it).append(item);
}
tree.reserve(tree.size() + groups.size());
for( typename GroupMap::const_iterator it = groups.constBegin(); it != groups.constEnd(); ++it ) {
QExplicitlySharedDataPointer<CompletionTreeNode> node(new CompletionTreeNode());
node->setParent(parent);
......
......@@ -139,6 +139,7 @@ struct CodeCompletionItemTester
addElements(completionContext->ungroupedElements());
names.reserve(items.size());
foreach(Item i, items) {
names << i->data(fakeModel().index(0, KTextEditor::CodeCompletionModel::Name), Qt::DisplayRole, nullptr).toString();
}
......
......@@ -136,8 +136,9 @@ FunctionDescription::FunctionDescription(const DeclarationPointer& declaration)
}
int i = 0;
foreach (Declaration* arg, context->localDeclarations())
{
const auto localDeclarations = context->localDeclarations();
arguments.reserve(localDeclarations.size());
for (Declaration* arg : localDeclarations) {
VariableDescription var = VariableDescription(DeclarationPointer(arg));
if (function)
{
......
......@@ -257,6 +257,7 @@ namespace CodeDescription
template <class T> QVariant toVariantList(const QVector<T>& list)
{
QVariantList ret;
ret.reserve(list.size());
foreach (const T& t, list)
{
ret << QVariant::fromValue<T>(t);
......
......@@ -206,7 +206,9 @@ DocumentChangeSet::ChangeResult DocumentChangeSet::applyAllChanges()
}
QList<QUrl> allFiles;
foreach (IndexedString file, d->documentsRename.keys().toSet() + d->changes.keys().toSet()) {
const auto changedFiles = d->documentsRename.keys().toSet() + d->changes.keys().toSet();
allFiles.reserve(changedFiles.size());
for (const IndexedString& file : changedFiles) {
allFiles << file.toUrl();
}
......@@ -451,7 +453,10 @@ DocumentChangeSet::ChangeResult DocumentChangeSetPrivate::generateNewText(const
line.replace(change.m_range.start().column(), line.length() - change.m_range.start().column(),
change.m_newText);
// null other lines and remember for deletion
for(int i = change.m_range.start().line() + 1; i <= change.m_range.end().line(); ++i) {
const int firstLine = change.m_range.start().line() + 1;
const int lastLine = change.m_range.end().line();
removedLines.reserve(removedLines.size() + lastLine - firstLine + 1);
for (int i = firstLine; i <= lastLine; ++i) {
textLines[i].clear();
removedLines << i;
}
......
......@@ -89,6 +89,7 @@ ConfigOption SourceFileTemplatePrivate::readEntry(const QDomElement& element,
else if (tag == QLatin1String("choices")) {
QStringList values;
QDomNodeList choices = element.elementsByTagName(QStringLiteral("choice"));
values.reserve(choices.size());
for (int j = 0; j < choices.size(); ++j) {
QDomElement choiceElement = choices.at(j).toElement();
values << choiceElement.attribute(QStringLiteral("name"));
......
......@@ -235,6 +235,7 @@ QStringList TemplateRenderer::render(const QStringList& contents) const
{
qCDebug(LANGUAGE) << d->context.stackHash(0);
QStringList ret;
ret.reserve(contents.size());
foreach (const QString& content, contents)
{
ret << render(content);
......
......@@ -166,6 +166,7 @@ QStandardItem *TemplatesModelPrivate::createItem(const QString& name, const QStr
QStringList path = category.split(QLatin1Char('/'));
QStringList currentPath;
currentPath.reserve(path.size());
foreach (const QString& entry, path)
{
currentPath << entry;
......@@ -319,6 +320,7 @@ QModelIndexList TemplatesModel::templateIndexes(const QString& fileName) const
QStringList categories = general.readEntry("Category").split(QLatin1Char('/'));
QStringList levels;
levels.reserve(categories.size());
foreach (const QString& category, categories)
{
levels << category;
......
......@@ -866,12 +866,14 @@ QVector<DUContext*> DUContext::importers() const
ENSURE_CAN_READ
QVector<DUContext*> ret;
ret.reserve(d_func()->m_importersSize());
FOREACH_FUNCTION(const IndexedDUContext& ctx, d_func()->m_importers)
ret << ctx.context();
if(owner()) {
//Add indirect importers to the list
KDevVarLengthArray<IndexedDUContext> indirect = Importers::self().importers(owner()->id());
ret.reserve(ret.size() + indirect.size());
foreach (const IndexedDUContext ctx, indirect) {
ret << ctx.context();
}
......
......@@ -776,9 +776,11 @@ QStringList QualifiedIdentifier::toStringList(IdentifierStringFormattingOptions
ret.append(QString());
if(m_index) {
ret.reserve(ret.size() + cd->identifiersSize());
FOREACH_FUNCTION_STATIC(const IndexedIdentifier& index, cd->identifiers)
ret << index.identifier().toString(options);
}else{
ret.reserve(ret.size() + dd->identifiersSize());
FOREACH_FUNCTION_STATIC(const IndexedIdentifier& index, dd->identifiers)
ret << index.identifier().toString(options);
}
......
......@@ -198,6 +198,8 @@ void UsesCollector::startCollecting() {
///Step 4: Copy allDeclarations into m_declarations, build top-context list, etc.
QList<ReferencedTopDUContext> candidateTopContexts;
candidateTopContexts.reserve(allDeclarations.size());
m_declarations.reserve(allDeclarations.size());
foreach(const IndexedDeclaration d, allDeclarations) {
m_declarations << d;
m_declarationTopContexts.insert(d.indexedTopContext());
......
......@@ -174,6 +174,7 @@ QList< QExplicitlySharedDataPointer<ParsingEnvironmentFile> > ParsingEnvironment
IndexedTopDUContext top = indexedTopContext();
if(top.isLoaded()) {
TopDUContext* topCtx = top.data();
imp.reserve(topCtx->d_func()->m_importedContextsSize());
FOREACH_FUNCTION(const DUContext::Import& import, topCtx->d_func()->m_importedContexts)
imp << import.indexedContext();
}else{
......
......@@ -47,6 +47,7 @@ LocalIndexedProblem::LocalIndexedProblem(const ProblemPointer& problem, const To
// the const cast is ugly but we don't really "change" the state as observed from the outside
auto& serialized = const_cast<Problem*>(problem.data())->d_func_dynamic()->diagnosticsList();
serialized.clear();
serialized.reserve(problem->m_diagnostics.size());
foreach(const ProblemPointer& child, problem->m_diagnostics) {
serialized << LocalIndexedProblem(child, top);
}
......
......@@ -248,6 +248,7 @@ int findCommaOrEnd( const QString& str , int pos, QChar validEnd)
QString reverse( const QString& str ) {
QString ret;
int len = str.length();
ret.reserve(len);
for( int a = len-1; a >= 0; --a ) {
switch(str[a].unicode()) {
case '(':
......@@ -336,11 +337,13 @@ void skipFunctionArguments(QString str, QStringList& skippedArguments, int& argu
QString reduceWhiteSpace(QString str) {
str = str.trimmed();
QString ret;
const int len = str.length();
ret.reserve(len);
QChar spaceChar = QLatin1Char(' ');
bool hadSpace = false;
for( int a = 0; a < str.length(); a++ ) {
for (int a = 0; a < len; ++a) {
if( str[a].isSpace() ) {
hadSpace = true;
} else {
......@@ -351,7 +354,7 @@ QString reduceWhiteSpace(QString str) {
ret += str[a];
}
}
ret.squeeze();
return ret;
}
......
......@@ -287,6 +287,7 @@ void TopDUContextDynamicData::DUChainItemStorage<Item>::storeData(uint& currentD
{
auto const oldOffsets = offsets;
offsets.clear();
offsets.reserve(items.size());
for (int a = 0; a < items.size(); ++a) {
auto item = items[a];
if (!item) {
......
......@@ -108,6 +108,7 @@ QList<AbstractType::Ptr> FunctionType::arguments () const
{
///@todo Don't do the conversion
QList<AbstractType::Ptr> ret;
ret.reserve(d_func()->m_argumentsSize());
FOREACH_FUNCTION(const IndexedType& arg, d_func()->m_arguments)
ret << arg.abstractType();
return ret;
......
......@@ -198,6 +198,7 @@ public:
{
model->beginInsertRows( QModelIndex(), model->rowCount(), model->rowCount() + items.size() - 1);
m_filteredItems.reserve(m_filteredItems.size() + items.size());
foreach( const FilteredItem& item, items ) {
if( item.type == FilteredItem::ErrorItem ) {
m_errorItems.insert(m_filteredItems.size());
......
......@@ -231,6 +231,7 @@ void BuilderJob::updateJobName()
QString itemNames;
if( !hasNullItems ) {
QStringList itemNamesList;
itemNamesList.reserve(registeredItems.size());
foreach( ProjectBaseItem* item, registeredItems ) {
itemNamesList << item->text();
}
......@@ -241,6 +242,7 @@ void BuilderJob::updateJobName()
QString methodNames;
QStringList methodNamesList;
methodNamesList.reserve(buildTypes.size());
foreach( BuildType type, buildTypes ) {
methodNamesList << d->buildTypeToString( type );
}
......
......@@ -121,6 +121,7 @@ void ProjectBuildSetModel::loadFromSession( ISession* session )
// Load the item ordering cache
KConfigGroup sessionBuildSetConfig = session->config()->group( "Buildset" );
QVariantList sessionBuildItems = KDevelop::stringToQVariant( sessionBuildSetConfig.readEntry( "BuildItems", QString() ) ).toList();
d->orderingCache.reserve(d->orderingCache.size() + sessionBuildItems.size());
foreach( const QVariant& item, sessionBuildItems ) {
d->orderingCache.append(item.toStringList());
}
......@@ -134,6 +135,7 @@ void ProjectBuildSetModel::storeToSession( ISession* session )
// Store the item ordering cache
QVariantList sessionBuildItems;
sessionBuildItems.reserve(d->orderingCache.size());
foreach (const QStringList& item, d->orderingCache) {
sessionBuildItems.append( item );
}
......@@ -232,6 +234,7 @@ void ProjectBuildSetModel::insertItemsOverrideCache( int index, const QList< Bui
if (index == d->items.size()) {
beginInsertRows( QModelIndex(), index, index + items.size() - 1 );
d->items.append(items);
d->orderingCache.reserve(d->orderingCache.size() + items.size());
foreach( const BuildItem& item, items ) {
d->orderingCache.append(item.itemPath());
}
......
......@@ -80,6 +80,7 @@ public:
activeLanguages.clear();
QList<ILanguageSupport*> languages = m_controller->languagesForUrl(url);
activeLanguages.reserve(languages.size());
foreach (const auto lang, languages) {
activeLanguages << lang;
}
......@@ -194,6 +195,7 @@ QList<ILanguageSupport*> LanguageController::loadedLanguages() const
if(d->m_cleanedUp)
return ret;
ret.reserve(d->languages.size());
foreach(ILanguageSupport* lang, d->languages)
ret << lang;
return ret;
......
......@@ -490,9 +490,10 @@ LaunchConfigurationsModel::LaunchConfigurationsModel(QObject* parent): QAbstract
GenericPageItem* global = new GenericPageItem;
global->text = i18n("Global");
global->row = 0;
const auto projects = Core::self()->projectController()->projects();
topItems.reserve(1 + projects.size());
topItems << global;
foreach( IProject* p, Core::self()->projectController()->projects() )
{
for (IProject* p : projects) {
ProjectItem* t = new ProjectItem;
t->project = p;
t->row = topItems.count();
......
......@@ -258,12 +258,14 @@ void OpenProjectDialog::validateOpenUrl( const QUrl& url_ )
plugins.removeAll(QStringLiteral("<built-in>"));
choices.append({i18n("Open existing file \"%1\"", file), QStringLiteral("<built-in>"), QString()});
}
choices.reserve(choices.size() + plugins.size());
Q_FOREACH ( const auto& plugin, plugins ) {
auto meta = m_projectPlugins.value(plugin);
choices.append({file + QLatin1String(" (") + plugin + QLatin1Char(')'), meta.pluginId(), meta.iconName(), file});
}
}
// add managers that work in any case (e.g. KDevGenericManager)
choices.reserve(choices.size() + m_genericProjectPlugins.size());
Q_FOREACH ( const auto& plugin, m_genericProjectPlugins ) {
qCDebug(SHELL) << plugin;
auto meta = m_projectPlugins.value(plugin);
......
......@@ -309,6 +309,7 @@ PluginController::PluginController(Core *core)
});
qCDebug(SHELL) << "Found" << ktePlugins.size() << " KTextEditor plugins:" << foundPlugins;
d->plugins.reserve(d->plugins.size() + ktePlugins.size());
foreach (const auto& info, ktePlugins) {
auto data = info.rawData();
// add some KDevelop specific JSON data
......@@ -689,6 +690,7 @@ QVector<KPluginMetaData> PluginController::queryExtensionPlugins(const QString&
QStringList PluginController::allPluginNames()
{
QStringList names;
names.reserve(d->plugins.size());
Q_FOREACH( const KPluginMetaData& info , d->plugins )
{
names << info.pluginId();
......@@ -708,6 +710,7 @@ QList<ContextMenuExtension> PluginController::queryPluginsForContextMenuExtensio
}
QList<ContextMenuExtension> exts;
exts.reserve(sortedPlugins.size());
foreach (IPlugin* plugin, sortedPlugins) {
exts << plugin->contextMenuExtension(context, parent);
}
......
......@@ -141,7 +141,9 @@ public:
options.project = proj;
foreach (IPlugin* plugin, findPluginsForProject(proj)) {
for (int i = 0; i < plugin->perProjectConfigPages(); ++i) {
const int perProjectConfigPagesCount = plugin->perProjectConfigPages();
configPages.reserve(configPages.size() + perProjectConfigPagesCount);
for (int i = 0; i < perProjectConfigPagesCount; ++i) {
configPages.append(plugin->perProjectConfigPage(i, options, cfgDlg));
}
}
......@@ -945,6 +947,7 @@ void ProjectController::unloadUnusedProjectPlugins(IProject* proj)
d->m_projectPlugins.remove( proj );
QList<IPlugin*> otherProjectPlugins;
otherProjectPlugins.reserve(d->m_projectPlugins.size());
Q_FOREACH( const QList<IPlugin*>& _list, d->m_projectPlugins )
{
otherProjectPlugins << _list;
......
......@@ -53,6 +53,7 @@ ProjectSourcePage::ProjectSourcePage(const QUrl& initial, const QUrl& repoUrl, I
int preselectIndex = -1;
IPluginController* pluginManager = ICore::self()->pluginController();
QList<IPlugin*> plugins = pluginManager->allPluginsForExtension( QStringLiteral("org.kdevelop.IBasicVersionControl") );
m_plugins.reserve(m_plugins.size() + plugins.size());
foreach( IPlugin* p, plugins )
{
if (p == preSelectPlugin) {
......@@ -63,6 +64,7 @@ ProjectSourcePage::ProjectSourcePage(const QUrl& initial, const QUrl& repoUrl, I
}
plugins = pluginManager->allPluginsForExtension( QStringLiteral("org.kdevelop.IProjectProvider") );
m_plugins.reserve(m_plugins.size() + plugins.size());
foreach( IPlugin* p, plugins )
{
if (p == preSelectPlugin) {
......
......@@ -752,8 +752,11 @@ QList< KJob * > KDevelop::RunController::currentJobs() const
QList<ILaunchConfiguration*> RunController::launchConfigurations() const
{
QList<ILaunchConfiguration*> configs;
foreach (LaunchConfiguration *config, launchConfigurationsInternal())
const auto configsInternal = launchConfigurationsInternal();
configs.reserve(configsInternal.size());
for (LaunchConfiguration* config : configsInternal) {
configs << config;
}
return configs;
}
......
......@@ -362,8 +362,9 @@ void SessionController::loadSession( const QString& nameOrId )
QList<QString> SessionController::sessionNames() const
{
QStringList l;
foreach( const Session* s, d->sessionActions.keys() )
{
const auto sessions = d->sessionActions.keys();
l.reserve(sessions.size());
for(const auto* s : sessions) {
l << s->name();
}
return l;
......@@ -372,8 +373,10 @@ QList<QString> SessionController::sessionNames() const
QList< const KDevelop::Session* > SessionController::sessions() const
{
QList< const KDevelop::Session* > ret;
foreach( const Session* s, d->sessionActions.keys() )
{
const auto sessions = d->sessionActions.keys();
ret.reserve(sessions.size());
// turn to const pointers
for (const auto* s : sessions) {
ret << s;
}
return ret;
......@@ -500,11 +503,14 @@ QString SessionController::cfgActiveSessionEntry() { return QStringLiteral("Acti
SessionInfos SessionController::availableSessionInfos()
{
SessionInfos sessionInfos;
foreach( const QString& sessionId, QDir( SessionControllerPrivate::sessionBaseDirectory() ).entryList( QDir::AllDirs ) ) {
const auto sessionDirs = QDir(SessionControllerPrivate::sessionBaseDirectory()).entryList(QDir::AllDirs);
sessionInfos.reserve(sessionDirs.size());
for (const QString& sessionId : sessionDirs) {
if( !QUuid( sessionId ).isNull() ) {
sessionInfos << Session::parse( sessionId );
}
}
sessionInfos.squeeze();
return sessionInfos;
}
......
......@@ -190,6 +190,7 @@ void EnvironmentProfileModel::setCurrentProfile(const QString& profileName)
if (!m_currentProfileName.isEmpty()) {
const auto& variables = m_profileListModel->variables(m_currentProfileName);
m_varsByIndex.reserve(variables.size());
const auto endIt = variables.constEnd();
for (auto it = variables.constBegin(); it != endIt; ++it) {
m_varsByIndex << it.key();
......
......@@ -208,6 +208,7 @@ void loadFileList(QStringList& ret, KConfigGroup group)
} else {
int viewCount = group.readEntry("View Count", 0);
ret.reserve(ret.size() + viewCount);
for (int i = 0; i < viewCount; ++i) {
QString specifier = group.readEntry(QStringLiteral("View %1").arg(i), QString());
......
......@@ -299,6 +299,7 @@ void Area::setTitle(const QString &title)
void Area::save(KConfigGroup& group) const
{
QStringList desired;
desired.reserve(d->desiredToolViews.size());
QMap<QString, Sublime::Position>::iterator i, e;
for (i = d->desiredToolViews.begin(), e = d->desiredToolViews.end(); i != e; ++i)
{
......@@ -357,6 +358,7 @@ QStringList Area::shownToolViews(Sublime::Position pos) const
{
if (pos == Sublime::AllPositions) {
QStringList allIds;
allIds.reserve(d->shownToolViews.size());
std::for_each(d->shownToolViews.constBegin(), d->shownToolViews.constEnd(), [&](const QStringList& ids) {
allIds << ids;
});
......
......@@ -241,8 +241,11 @@ QString AreaIndex::print() const
if(isSplit())
return QLatin1String(" [ ") + first()->print() + QLatin1String(orientation() == Qt::Horizontal ? " / " : " - ") + second()->print() + QLatin1String(" ] ");
QStringList ret;
foreach(Sublime::View* view, views())
const auto views = this->views();
ret.reserve(views.size());
for (const auto* view : views) {
ret << view->document()->title();
}
return ret.join(QLatin1Char(' '));
}
......
......@@ -236,11 +236,15 @@ void Controller::addMainWindow(MainWindow* mainWindow)
d->mainWindowAreas.resize(d->controlledWindows.size());
int index = d->controlledWindows.size()-1;
foreach (Area* area, defaultAreas())
{
auto& mainWindowAreas = d->mainWindowAreas[index];
const auto& defaultAreas = this->defaultAreas();
d->allAreas.reserve(d->allAreas.size() + defaultAreas.size());
mainWindowAreas.reserve(defaultAreas.size());
for (const auto* area : defaultAreas) {
Area *na = new Area(*area);
d->allAreas.append(na);
d->mainWindowAreas[index].push_back(na);
mainWindowAreas.append(na);
emit areaCreated(na);
}
showAreaInternal(d->mainWindowAreas[index][0], mainWindow);
......
......@@ -524,6 +524,7 @@ void MainWindowPrivate::slotDockShown(Sublime::View* /*view*/, Sublime::Position
m_mainWindow->area()->walkToolViews(finder, pos);
QStringList ids;
ids.reserve(finder.views.size());
foreach (View *v, finder.views) {
ids << v->document()->documentSpecifier();
}
......
......@@ -120,8 +120,9 @@ QVariant SplitLinesFilter::doFilter(const QVariant& input, const QVariant& argum
{
QStringList retLines;
QString start = safeString(argument);
foreach (const QString& line, safeString(input).split(QLatin1Char('\n'), QString::KeepEmptyParts))
{
const auto lines = safeString(input).split(QLatin1Char('\n'), QString::KeepEmptyParts);
retLines.reserve(lines.size());
for (const auto& line : lines) {
retLines << start + line;
}
return Grantlee::SafeString(retLines.join(QLatin1Char('\n')));
......
......@@ -129,6 +129,7 @@ void CommandExecutor::start()
d->m_process->setProgram( d->m_command, d->m_args );
} else {
QStringList arguments;
arguments.reserve(d->m_args.size());
Q_FOREACH( const QString &a, d->m_args ) arguments << KShell::quoteArg( a );
d->m_process->setShellCommand(d->m_command + QLatin1Char(' ') + arguments.join(QLatin1Char(' ')));
}
......
......@@ -191,6 +191,7 @@ QStringList EnvironmentProfileList::createEnvironment(const QString& profileName
}
QStringList env;
env.reserve(retMap.size());
for( QMap<QString, QString>::const_iterator it = retMap.constBegin();
it != retMap.constEnd(); ++it )
{
......
......@@ -70,6 +70,7 @@ int matchPrefixIgnoringWhitespace(const QString& text, const QString& prefix, co
static QString reverse( const QString& str ) {
QString ret;
ret.reserve(str.length());
for(int a = str.length()-1; a >= 0; --a)
ret.append(str[a]);
......
......@@ -285,6 +285,9 @@ void MultiLevelListView::setLevels(int levels)
d->layouts.clear();
d->levels = levels;
d->views.reserve(levels);
d->proxies.reserve(levels);
d->layouts.reserve(levels);
QTreeView* previousView = nullptr;
for (int i = 0; i < d->levels; ++i)
......
......@@ -480,6 +480,7 @@ static Path::List toPathList_impl(const Container& list)
ret << path;
}
}
ret.squeeze();
return ret;
}
......
......@@ -245,7 +245,9 @@ QList<QUrl> VcsFileChangesModel::urls(QStandardItem *parent) const
}
QList<QUrl> ret;
for(int i = 0, c = parent->rowCount(); i < c; i++) {
const int c = parent->rowCount();
ret.reserve(c);
for (int i = 0; i < c; i++) {
QStandardItem* item = parent->child(i);
ret << indexFromItem(item).data(UrlRole).toUrl();
}
......
......@@ -137,8 +137,9 @@ VCSDiffPatchSource::VCSDiffPatchSource(VCSDiffUpdater* updater)
{
varlist = statusJob->fetchResults();
foreach( const QVariant &var, varlist.toList() )
{
const auto vars = varlist.toList();
m_infos.reserve(m_infos.size() + vars.size());
for (const auto& var : vars) {
VcsStatusInfo info = var.value<KDevelop::VcsStatusInfo>();
m_infos += info;
......
......@@ -146,7 +146,9 @@ bool BazaarPlugin::isVersionControlled(const QUrl& localLocation)
job->exec();
if (job->status() == VcsJob::JobSucceeded) {
QList<QFileInfo> filesAndDirectoriesList;
foreach (const QString& fod, job->output().split('\n')) {
const auto output = job->output().split('\n');
filesAndDirectoriesList.reserve(output.size());
for (const auto& fod : output) {
filesAndDirectoriesList.append(QFileInfo(workCopy.absolutePath() + QDir::separator() + fod));
}