From e5d10b2a3be77244d8db3a4dac86168ee9b91e6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Abecasis?= Date: Wed, 4 Apr 2012 13:50:21 +0200 Subject: 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 Reviewed-by: Thiago Macieira --- src/corelib/tools/qbytearray.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/corelib/tools/qbytearray.h') diff --git a/src/corelib/tools/qbytearray.h b/src/corelib/tools/qbytearray.h index 93e241904d..62273c55fd 100644 --- a/src/corelib/tools/qbytearray.h +++ b/src/corelib/tools/qbytearray.h @@ -406,7 +406,7 @@ private: static const QStaticByteArrayData<1> shared_null; static const QStaticByteArrayData<1> shared_empty; Data *d; - void realloc(int alloc); + void realloc(int alloc, bool grow = false); void expand(int i); QByteArray nulTerminated() const; -- cgit v1.2.3