Skip to content

Commit f6d50b2

Browse files
committed
run container-anti-pattern clazy check
1 parent 4ddcd8a commit f6d50b2

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

src/repository.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -575,8 +575,9 @@ void FastImportRepository::closeFastImport()
575575
void FastImportRepository::reloadBranches()
576576
{
577577
bool reset_notes = false;
578-
foreach (QString branch, branches.keys()) {
579-
Branch &br = branches[branch];
578+
for (auto it = branches.keyValueBegin(); it != branches.keyValueEnd(); ++it) {
579+
const QString &branch = it->first;
580+
Branch &br = it->second;
580581

581582
if (br.marks.isEmpty() || !br.marks.last())
582583
continue;
@@ -1099,8 +1100,9 @@ bool FastImportRepository::Transaction::commitNote(const QByteArray &noteText, b
10991100

11001101
int FastImportRepository::Transaction::commit()
11011102
{
1102-
foreach (QString branchName, repository->branches.keys())
1103+
for (auto it = repository->branches.keyValueBegin(); it != repository->branches.keyValueEnd(); ++it)
11031104
{
1105+
const QString &branchName = it->first;
11041106
if (branchName.toUtf8().startsWith(branch + "/") || branch.startsWith((branchName + "/").toUtf8()))
11051107
{
11061108
qCritical() << "Branch" << branch << "conflicts with already existing branch" << branchName;

src/ruleparser.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -381,8 +381,8 @@ Stats::Private::Private()
381381
void Stats::Private::printStats() const
382382
{
383383
printf("\nRule stats\n");
384-
foreach(const Rules::Match rule, m_usedRules.keys()) {
385-
printf("%s was matched %i times\n", qPrintable(rule.info()), m_usedRules[rule]);
384+
for (auto it = m_usedRules.keyValueBegin(); it != m_usedRules.keyValueEnd(); ++it) {
385+
printf("%s was matched %i times\n", qPrintable(it->first.info()), it->second);
386386
}
387387
}
388388

src/svn.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -567,8 +567,8 @@ int SvnRevision::commit()
567567
// now create the commit
568568
if (fetchRevProps() != EXIT_SUCCESS)
569569
return EXIT_FAILURE;
570-
foreach (Repository *repo, repositories.values()) {
571-
repo->commit();
570+
for (auto it = repositories.keyValueBegin(); it != repositories.keyValueEnd(); ++it) {
571+
it->second->commit();
572572
}
573573

574574
foreach (Repository::Transaction *txn, transactions) {

0 commit comments

Comments
 (0)