Use new QBA::assign in QCoreApplication::applicationFilePath()

QByteArray::assign() re-uses existing unshared capacity(), if any, and
is therefore potentially more efficient than '= QByteArray(~)' (and
never slower).

Task-number: QTBUG-106201
Change-Id: Ieeb254afd94e26f1b425795feb53c59ebb2322c6
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 5e2d95db97310492ef73220f087f00dabae79ab1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Dennis Oberst 2023-07-31 14:40:19 +02:00 committed by Qt Cherry-pick Bot
parent cc7079e5b8
commit a835abd6e3

View File

@ -2452,7 +2452,7 @@ QString QCoreApplication::applicationFilePath()
if (procName != d->argv[0]) { if (procName != d->argv[0]) {
// clear the cache if the procname changes, so we reprocess it. // clear the cache if the procname changes, so we reprocess it.
QCoreApplicationPrivate::clearApplicationFilePath(); QCoreApplicationPrivate::clearApplicationFilePath();
procName = QByteArray(d->argv[0]); procName.assign(d->argv[0]);
} }
} }