Cache QUrl::idnWhiteList() absent user_idn_whitelist
Instead of creating a QStringList from a static array anew for each call, cache the result in a static variable. If we have to pay for the overhead of implicitly-shared classes, we should at least reap the benefits, too. Use IILE to gain automatic thread-safety (thread-safe statics). Change-Id: Ib92dd9cb85f84e013f98ca81565cc392bb39e76b Reviewed-by: Lars Knoll <lars.knoll@qt.io>
This commit is contained in:
parent
565c2e8cf9
commit
ed4c1b4e90
@ -2605,6 +2605,7 @@ QStringList QUrl::idnWhitelist()
|
||||
{
|
||||
if (user_idn_whitelist)
|
||||
return *user_idn_whitelist;
|
||||
static const QStringList list = [] {
|
||||
QStringList list;
|
||||
list.reserve(idn_whitelist_size);
|
||||
unsigned int i = 0;
|
||||
@ -2613,6 +2614,8 @@ QStringList QUrl::idnWhitelist()
|
||||
++i;
|
||||
}
|
||||
return list;
|
||||
}();
|
||||
return list;
|
||||
}
|
||||
|
||||
/*!
|
||||
|
Loading…
Reference in New Issue
Block a user