Move growth computation to re-allocation function
authorJoão Abecasis <joao.abecasis@nokia.com>
Wed, 4 Apr 2012 11:50:21 +0000 (13:50 +0200)
committerQt by Nokia <qt-info@nokia.com>
Wed, 4 Apr 2012 23:44:34 +0000 (01:44 +0200)
commite5d10b2a3be77244d8db3a4dac86168ee9b91e6f
treee9f2a63e957d95fd2f10a62c772aaa993bdd9f79
parent7488b79652cb18de3e2b295835c08a46f3e286f4
Move growth computation to re-allocation function

Callers of QByteArray/QString::realloc() are still responsible for the
heuristics and decide whether to provide the "grow" hint, but
computation is centralized there.

With this change we also ensure growth takes into account the
terminating null. Previously, calls to qAllocMore took into account
header and string size, for left out the null, meaning we ended up
allocating ("nice-size" + Null).

Change-Id: Iad1536e7706cd2d446daee96859db9b01c5f9680
Reviewed-by: Marius Storm-Olsen <marius.storm-olsen@nokia.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
src/corelib/tools/qbytearray.cpp
src/corelib/tools/qbytearray.h
src/corelib/tools/qstring.cpp
src/corelib/tools/qstring.h