QTranslator: optimize string handling in find_transformation
- Don't repeatedly truncate a (shared) QString, truncate a QStringRef instead, preventing a detach. Change-Id: I1a9cf7fc5bc9ea06279f7e2548f2bd144b8780a3 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
This commit is contained in:
parent
6926e0d484
commit
066caebd8a
@ -668,7 +668,8 @@ static QString find_translation(const QLocale & locale,
|
||||
}
|
||||
|
||||
// start guessing
|
||||
for (QString localeName : qAsConst(fuzzyLocales)) {
|
||||
for (const QString &fuzzyLocale : qAsConst(fuzzyLocales)) {
|
||||
QStringRef localeName(&fuzzyLocale);
|
||||
for (;;) {
|
||||
int rightmost = localeName.lastIndexOf(QLatin1Char('_'));
|
||||
// no truncations? fail
|
||||
|
Loading…
Reference in New Issue
Block a user