tst_QFreeList: build with QT_NO_FOREACH

The container is local to the function, but can't be made const due to
the way it's filled. The loop clearly doesn't modify the container so
use std::as_const and ranged-for.

Task-number: QTBUG-115839
Change-Id: Ia9f01dfaccfca3225fe0487aafd0a386605cf466
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
bb10
Ahmad Samir 2023-08-11 18:11:04 +03:00
parent 964e6c6754
commit 9aeb38650d
1 changed files with 1 additions and 3 deletions

View File

@ -1,8 +1,6 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#undef QT_NO_FOREACH // this file contains unported legacy Q_FOREACH uses
#include <QtCore/QCoreApplication>
#include <QtCore/QElapsedTimer>
#include <QtCore/QList>
@ -117,7 +115,7 @@ public:
needToRelease << i;
} while (t.elapsed() < TimeLimit);
foreach (int x, needToRelease)
for (int x : std::as_const(needToRelease))
freelist.release(x);
}
};