Commit f976dc96 authored by Montel Laurent's avatar Montel Laurent Committed by Laurent Montel
Browse files

Reserve some elements



Change-Id: Iceef4e9a6f213a747045db3b06a5608d77652f98
Reviewed-by: Orgad Shaneh's avatarOrgad Shaneh <orgads@gmail.com>
parent f18ae4ff
......@@ -181,6 +181,7 @@ QVariant OverviewModel::data(const QModelIndex &index, int role) const
if (Template *t = symbol->asTemplate())
if (Symbol *templateDeclaration = t->declaration()) {
QStringList parameters;
parameters.reserve(t->templateParameterCount());
for (unsigned i = 0; i < t->templateParameterCount(); ++i)
parameters.append(_overview.prettyName(t->templateParameterAt(i)->name()));
name += QLatin1Char('<') + parameters.join(QLatin1String(", ")) + QLatin1Char('>');
......
......@@ -193,6 +193,7 @@ void BaseEngineDebugClient::messageReceived(const QByteArray &data)
int count;
ds >> count;
QList<EngineReference> engines;
engines.reserve(count);
for (int ii = 0; ii < count; ++ii) {
EngineReference eng;
ds >> eng.m_name;
......
......@@ -365,6 +365,7 @@ void CrumblePath::resizeButtons()
// compute relative sizes
QList<int> sizes;
int totalSize = 0;
sizes.reserve(m_buttons.length());
for (int i = 0; i < m_buttons.length() ; ++i) {
CrumblePathButton *button = m_buttons.at(i);
......
......@@ -931,6 +931,7 @@ Id EditorManagerPrivate::getOpenWithEditorId(const QString &fileName, bool *isEx
// Built-in
const EditorManager::EditorFactoryList editors = EditorManager::editorFactories(mt, false);
const int size = editors.size();
allEditorDisplayNames.reserve(size);
for (int i = 0; i < size; i++) {
allEditorIds.push_back(editors.at(i)->id());
allEditorDisplayNames.push_back(editors.at(i)->displayName());
......
......@@ -89,6 +89,7 @@ static QList<Diff> decode(const QList<Diff> &diffList,
const QStringList &lines)
{
QList<Diff> newDiffList;
newDiffList.reserve(diffList.count());
for (int i = 0; i < diffList.count(); i++) {
Diff diff = diffList.at(i);
QString text;
......
......@@ -190,6 +190,7 @@ void AbiWidget::setAbis(const QList<Abi> &abiList, const Abi &current)
QList<Abi> AbiWidget::supportedAbis() const
{
QList<Abi> result;
result.reserve(d->m_abi->count());
for (int i = 1; i < d->m_abi->count(); ++i)
result << Abi(d->m_abi->itemData(i).toString());
return result;
......
......@@ -94,6 +94,7 @@ public:
QIcon icon = QIcon::fromTheme(QLatin1String("edit-paste"), Utils::Icons::PASTE.icon()).pixmap(16);
CircularClipboard * clipboard = CircularClipboard::instance();
QList<AssistProposalItemInterface *> items;
items.reserve(clipboard->size());
for (int i = 0; i < clipboard->size(); ++i) {
QSharedPointer<const QMimeData> data = clipboard->next();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment