Small cleanup
Change-Id: Ic8ed50a05a9723ed252f0762d86e41fe719fc3ef Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
6a47b5850b
commit
6dd9c0720b
@ -190,14 +190,6 @@ static QArrayData *allocateData(size_t allocSize, uint options)
|
|||||||
return header;
|
return header;
|
||||||
}
|
}
|
||||||
|
|
||||||
static QArrayData *reallocateData(QArrayData *header, size_t allocSize, uint options)
|
|
||||||
{
|
|
||||||
header = static_cast<QArrayData *>(::realloc(header, allocSize));
|
|
||||||
if (header)
|
|
||||||
header->flags = options;
|
|
||||||
return header;
|
|
||||||
}
|
|
||||||
|
|
||||||
void *QArrayData::allocate(QArrayData **dptr, size_t objectSize, size_t alignment,
|
void *QArrayData::allocate(QArrayData **dptr, size_t objectSize, size_t alignment,
|
||||||
size_t capacity, ArrayOptions options) noexcept
|
size_t capacity, ArrayOptions options) noexcept
|
||||||
{
|
{
|
||||||
@ -260,8 +252,9 @@ QArrayData::reallocateUnaligned(QArrayData *data, void *dataPointer,
|
|||||||
size_t allocSize = calculateBlockSize(capacity, objectSize, headerSize, options);
|
size_t allocSize = calculateBlockSize(capacity, objectSize, headerSize, options);
|
||||||
qptrdiff offset = reinterpret_cast<char *>(dataPointer) - reinterpret_cast<char *>(data);
|
qptrdiff offset = reinterpret_cast<char *>(dataPointer) - reinterpret_cast<char *>(data);
|
||||||
options |= AllocatedDataType | MutableData;
|
options |= AllocatedDataType | MutableData;
|
||||||
QArrayData *header = reallocateData(data, allocSize, options);
|
QArrayData *header = static_cast<QArrayData *>(::realloc(data, size_t(allocSize)));
|
||||||
if (header) {
|
if (header) {
|
||||||
|
header->flags = options;
|
||||||
header->alloc = uint(capacity);
|
header->alloc = uint(capacity);
|
||||||
dataPointer = reinterpret_cast<char *>(header) + offset;
|
dataPointer = reinterpret_cast<char *>(header) + offset;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user