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>bb10
parent
29cc33b916
commit
0d9489e7aa
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue