Mark the QArrayData alloc/dealloc functions as nothrow

Throwing is handled at a higher level.

Change-Id: I573e4ded135b61e35fbe6e188be09acf449911fc
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
This commit is contained in:
Thiago Macieira 2013-01-19 09:43:20 +08:00 committed by The Qt Project
parent 6aa09bbce5
commit 9592b98b55
4 changed files with 6 additions and 6 deletions

View File

@ -68,7 +68,7 @@ static const QArrayData &qt_array_empty = qt_array[0];
static const QArrayData &qt_array_unsharable_empty = qt_array[1];
QArrayData *QArrayData::allocate(size_t objectSize, size_t alignment,
size_t capacity, AllocationOptions options)
size_t capacity, AllocationOptions options) Q_DECL_NOTHROW
{
// Alignment is a power of two
Q_ASSERT(alignment >= Q_ALIGNOF(QArrayData)
@ -111,7 +111,7 @@ QArrayData *QArrayData::allocate(size_t objectSize, size_t alignment,
}
void QArrayData::deallocate(QArrayData *data, size_t objectSize,
size_t alignment)
size_t alignment) Q_DECL_NOTHROW
{
// Alignment is a power of two
Q_ASSERT(alignment >= Q_ALIGNOF(QArrayData)

View File

@ -116,9 +116,9 @@ struct Q_CORE_EXPORT QArrayData
static QArrayData *allocate(size_t objectSize, size_t alignment,
size_t capacity, AllocationOptions options = Default)
Q_REQUIRED_RESULT;
Q_DECL_NOTHROW Q_REQUIRED_RESULT;
static void deallocate(QArrayData *data, size_t objectSize,
size_t alignment);
size_t alignment) Q_DECL_NOTHROW;
static const QArrayData shared_null[2];
static QArrayData *sharedNull() { return const_cast<QArrayData*>(shared_null); }

View File

@ -67,7 +67,7 @@ int qFindByteArray(
const char *needle0, int needleLen);
int qAllocMore(int alloc, int extra)
int qAllocMore(int alloc, int extra) Q_DECL_NOTHROW
{
Q_ASSERT(alloc >= 0 && extra >= 0);
Q_ASSERT_X(alloc < (1 << 30) - extra, "qAllocMore", "Requested size is too large!");

View File

@ -58,7 +58,7 @@
QT_BEGIN_NAMESPACE
// implemented in qbytearray.cpp
int Q_CORE_EXPORT qAllocMore(int alloc, int extra);
int Q_CORE_EXPORT qAllocMore(int alloc, int extra) Q_DECL_NOTHROW;
QT_END_NAMESPACE