diff options
author | Robin Burchell <robin.burchell@collabora.com> | 2011-12-20 21:39:12 +0100 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-01-06 14:11:14 +0100 |
commit | b08daaedd45457b775cb90d2c2650510daff1c8d (patch) | |
tree | d68ea8016a15ee851813133a51897a7a81aedc16 /src/corelib/tools/qbytearray.cpp | |
parent | 514ef34d1f838be119961003c0411a88352ba535 (diff) |
Remove all non-inline of qMalloc/qFree/qRealloc.
We're trying to deprecate these, so don't use them anymore.
The inline uses of these have been left intact, for the moment. Inline code will
need to create their own non-inline allocation methods (for future-proofing to
allow alterations in how e.g. individual containers allocate)
Change-Id: I1071a487c25e95b7bb81a3327b20c5481fb5ed22
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
Diffstat (limited to 'src/corelib/tools/qbytearray.cpp')
-rw-r--r-- | src/corelib/tools/qbytearray.cpp | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/src/corelib/tools/qbytearray.cpp b/src/corelib/tools/qbytearray.cpp index d8c0668a39..8c625c2868 100644 --- a/src/corelib/tools/qbytearray.cpp +++ b/src/corelib/tools/qbytearray.cpp @@ -546,7 +546,7 @@ QByteArray qUncompress(const uchar* data, int nbytes) qWarning("qUncompress: Input data is corrupted"); return QByteArray(); } - QByteArray::Data *p = static_cast<QByteArray::Data *>(qRealloc(d.data(), sizeof(QByteArray::Data) + alloc + 1)); + QByteArray::Data *p = static_cast<QByteArray::Data *>(::realloc(d.data(), sizeof(QByteArray::Data) + alloc + 1)); if (!p) { // we are not allowed to crash here when compiling with QT_NO_EXCEPTIONS qWarning("qUncompress: could not allocate enough memory to uncompress data"); @@ -567,7 +567,7 @@ QByteArray qUncompress(const uchar* data, int nbytes) qWarning("qUncompress: Input data is corrupted"); return QByteArray(); } - QByteArray::Data *p = static_cast<QByteArray::Data *>(qRealloc(d.data(), sizeof(QByteArray::Data) + len + 1)); + QByteArray::Data *p = static_cast<QByteArray::Data *>(::realloc(d.data(), sizeof(QByteArray::Data) + len + 1)); if (!p) { // we are not allowed to crash here when compiling with QT_NO_EXCEPTIONS qWarning("qUncompress: could not allocate enough memory to uncompress data"); @@ -883,7 +883,7 @@ QByteArray &QByteArray::operator=(const QByteArray & other) { other.d->ref.ref(); if (!d->ref.deref()) - qFree(d); + free(d); d = other.d; return *this; } @@ -912,7 +912,7 @@ QByteArray &QByteArray::operator=(const char *str) } x->ref.ref(); if (!d->ref.deref()) - qFree(d); + free(d); d = x; return *this; } @@ -1302,7 +1302,7 @@ QByteArray::QByteArray(const char *str) d = const_cast<Data *>(&shared_empty.ba); } else { int len = qstrlen(str); - d = static_cast<Data *>(qMalloc(sizeof(Data) + len + 1)); + d = static_cast<Data *>(malloc(sizeof(Data) + len + 1)); Q_CHECK_PTR(d); d->ref = 1; d->size = len; @@ -1331,7 +1331,7 @@ QByteArray::QByteArray(const char *data, int size) } else if (size <= 0) { d = const_cast<Data *>(&shared_empty.ba); } else { - d = static_cast<Data *>(qMalloc(sizeof(Data) + size + 1)); + d = static_cast<Data *>(malloc(sizeof(Data) + size + 1)); Q_CHECK_PTR(d); d->ref = 1; d->size = size; @@ -1355,7 +1355,7 @@ QByteArray::QByteArray(int size, char ch) if (size <= 0) { d = const_cast<Data *>(&shared_null.ba); } else { - d = static_cast<Data *>(qMalloc(sizeof(Data) + size + 1)); + d = static_cast<Data *>(malloc(sizeof(Data) + size + 1)); Q_CHECK_PTR(d); d->ref = 1; d->size = size; @@ -1375,7 +1375,7 @@ QByteArray::QByteArray(int size, char ch) QByteArray::QByteArray(int size, Qt::Initialization) { - d = static_cast<Data *>(qMalloc(sizeof(Data) + size + 1)); + d = static_cast<Data *>(malloc(sizeof(Data) + size + 1)); Q_CHECK_PTR(d); d->ref = 1; d->size = size; @@ -1411,7 +1411,7 @@ void QByteArray::resize(int size) if (size == 0 && !d->capacityReserved) { Data *x = const_cast<Data *>(&shared_empty.ba); if (!d->ref.deref()) - qFree(d); + free(d); d = x; } else if (d == &shared_null.ba || d == &shared_empty.ba) { // @@ -1422,7 +1422,7 @@ void QByteArray::resize(int size) // which is used in place of the Qt 3 idiom: // QByteArray a(sz); // - Data *x = static_cast<Data *>(qMalloc(sizeof(Data) + size + 1)); + Data *x = static_cast<Data *>(malloc(sizeof(Data) + size + 1)); Q_CHECK_PTR(x); x->ref = 1; x->size = size; @@ -1464,7 +1464,7 @@ QByteArray &QByteArray::fill(char ch, int size) void QByteArray::realloc(int alloc) { if (d->ref != 1 || d->offset) { - Data *x = static_cast<Data *>(qMalloc(sizeof(Data) + alloc + 1)); + Data *x = static_cast<Data *>(malloc(sizeof(Data) + alloc + 1)); Q_CHECK_PTR(x); x->ref = 1; x->size = qMin(alloc, d->size); @@ -1474,10 +1474,10 @@ void QByteArray::realloc(int alloc) ::memcpy(x->data(), d->data(), x->size); x->data()[x->size] = '\0'; if (!d->ref.deref()) - qFree(d); + free(d); d = x; } else { - Data *x = static_cast<Data *>(qRealloc(d, sizeof(Data) + alloc + 1)); + Data *x = static_cast<Data *>(::realloc(d, sizeof(Data) + alloc + 1)); Q_CHECK_PTR(x); x->alloc = alloc; x->offset = 0; @@ -2730,7 +2730,7 @@ QByteArray QByteArray::toUpper() const void QByteArray::clear() { if (!d->ref.deref()) - qFree(d); + free(d); d = const_cast<Data *>(&shared_null.ba); d->ref.ref(); } @@ -3885,7 +3885,7 @@ QByteArray QByteArray::fromRawData(const char *data, int size) } else if (!size) { x = const_cast<Data *>(&shared_empty.ba); } else { - x = static_cast<Data *>(qMalloc(sizeof(Data) + 1)); + x = static_cast<Data *>(malloc(sizeof(Data) + 1)); Q_CHECK_PTR(x); x->ref = 1; x->size = size; |