diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2013-09-18 10:32:49 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-09-20 21:30:33 +0200 |
commit | 0d9489e7aa01641d6b76e1b8b769ccdcb3bb81a0 (patch) | |
tree | eb91d49c5541fa661bc8e1ba83d174f192274b5e /src/corelib/tools/qstring.cpp | |
parent | 29cc33b916c06ab30ca42b4d39d663fcccac5e76 (diff) |
QString: avoid a QLocale detach in vsprintf
I didn't dig deeper to check where the additional reference came from,
but tracing confirmed that the QSharedDataPointer<QLocalePrivate>::detach()
call is gone with this change.
Background:
QString::vsprintf is used in the logging framework, and as such shouldn't
waste any memory. It's currently anyway unusable from, say, signal handlers,
but this is low-hanging fruit that shaves off one of the dozen or so
memory allocations involved in a simple qFatal() call.
Change-Id: I19fa2148f669dfc7b5f276221151e25a4348cbfe
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Reviewed-by: Kai Koehne <kai.koehne@digia.com>
Diffstat (limited to 'src/corelib/tools/qstring.cpp')
-rw-r--r-- | src/corelib/tools/qstring.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp index b909e9e09b..ac7052f3a1 100644 --- a/src/corelib/tools/qstring.cpp +++ b/src/corelib/tools/qstring.cpp @@ -5505,7 +5505,7 @@ QString &QString::sprintf(const char *cformat, ...) QString &QString::vsprintf(const char* cformat, va_list ap) { - QLocale locale(QLocale::C); + const QLocale locale(QLocale::C); if (!cformat || !*cformat) { // Qt 1.x compat |