diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2012-08-27 10:39:16 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-03-29 04:04:40 +0100 |
commit | c400e16a58357c01fcc1567a42537be0767efadf (patch) | |
tree | b639c991675938995e3c3fed9c6d63caff580a22 /src/corelib/kernel/qeventloop_p.h | |
parent | 04ebd8e56f0a5b07fe419548b0ecc8b7845ce49c (diff) |
QMetaTypeId: use QByteArray, not QVarLengthArray, to construct type names
So far, type-name strings for class template instantiations were constructed
in QMetaTypeId::qt_metatype_id() by concatenating various bits and pieces
into a QVarLengthArray<char>, presumably to avoid the dynamic memory
allocation for small strings.
Yet, when passing the result to qRegisterNormalisedMetaType, which takes
a QByteArray, the QVarLengthArray was copied from, not by
QByteArray::fromRawData(), but by QByteArray(const char*,int), which
unconditionally results in a dynamic memory allocation after all.
What's worse: the characters are copied twice: First into the QVarLengthArray,
and then into the QByteArray.
Remove the first of these copies by using QByteArray+reserve() to copy
directly into the final QByteArray.
Change-Id: Id915798a318fe97279a7cc0aca176544f99c7e86
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Diffstat (limited to 'src/corelib/kernel/qeventloop_p.h')
0 files changed, 0 insertions, 0 deletions