summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qarraydata.h
diff options
context:
space:
mode:
authorJoão Abecasis <joao.abecasis@nokia.com>2012-02-16 23:25:33 +0100
committerQt by Nokia <qt-info@nokia.com>2012-02-29 14:31:15 +0100
commit7919c0529ed5bdafd9a7dab82780ad1b1bf33178 (patch)
tree3e7b80a204e982b095d239a26312ad486d58517f /src/corelib/tools/qarraydata.h
parentf94709366229b479a17457021cff0d664cfe8de7 (diff)
Add AllocationOption::Grow
This is meant to reduce the number of allocations on growing containers. It serves the same purpose as the existing qAllocMore which is currently used by container classes. While only a container knows when it is growing, it doesn't need to care how that information is used. qAllocMore is currently treated as a black-box and its result is (basically) forwarded blindly to an allocate function. In that respect, container code using qAllocMore acts as an intermediary. By merging that functionality in the allocate function itself we offer the same benefits without the intermediaries, allowing for simpler code and centralized decisions on memory allocation. Once all users of qAllocMore get ported to QArrayData and QArrayData::allocate, qAllocMore can be moved or more closely integrated into qarraydata.cpp and qtools_p.h can be dropped. Change-Id: I4c09bf7df274b45c399082fc7113a18e4641c5f0 Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
Diffstat (limited to 'src/corelib/tools/qarraydata.h')
-rw-r--r--src/corelib/tools/qarraydata.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/corelib/tools/qarraydata.h b/src/corelib/tools/qarraydata.h
index da2058dccf..351a75aade 100644
--- a/src/corelib/tools/qarraydata.h
+++ b/src/corelib/tools/qarraydata.h
@@ -81,9 +81,10 @@ struct Q_CORE_EXPORT QArrayData
}
enum AllocationOption {
- CapacityReserved = 0x1,
- Unsharable = 0x2,
- RawData = 0x4,
+ CapacityReserved = 0x1,
+ Unsharable = 0x2,
+ RawData = 0x4,
+ Grow = 0x8,
Default = 0
};