QLocale: replace a QList with QVLA for duplicate tracking

An alternative would have been QDuplicateTracker, but the maximum
number of entries in the tracker is statically limited to six, so we
don't need a fancy hash table, linear scan is good enough.

Pick-to: 6.3
Change-Id: I8ca97d239723b51892cb13a43b1d1a6412faa561
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
bb10
Marc Mutz 2022-01-27 22:39:45 +01:00
parent d13ee2dc1a
commit 096e8b5f65
1 changed files with 2 additions and 1 deletions

View File

@ -65,6 +65,7 @@ QT_WARNING_DISABLE_GCC("-Wfree-nonheap-object") // false positive tracking
#include "qdatetime.h"
#include "qstringlist.h"
#include "qvariant.h"
#include "qvarlengtharray.h"
#include "qstringbuilder.h"
#include "private/qnumeric_p.h"
#include <cmath>
@ -502,7 +503,7 @@ int QLocaleData::findLocaleIndex(QLocaleId lid)
int index = findLocaleIndexById(likelyId);
if (index >= 0)
return index;
QList<QLocaleId> tried;
QVarLengthArray<QLocaleId, 6> tried;
tried.push_back(likelyId);
#define CheckCandidate(id) do { \