diff options
author | Robin Burchell <robin+qt@viroteck.net> | 2012-03-22 21:44:13 +0100 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-03-31 16:46:40 +0200 |
commit | 47728445a5e7317ed2123a8824c54a012eeee142 (patch) | |
tree | 762385979cf489c0cb92a061ed7bde3cd077c851 /src/corelib/tools/qlist.h | |
parent | ad921347f701ea7f732633c9c584be9300317537 (diff) |
Remove all calls to, and deprecate qMalloc, qRealloc and qFree.
Callers should just call the standard allocation functions directly.
Adding an extra function call onto all basic memory management for the sake of
making it instrumentable in rare cases isn't really fair to everyone else.
What's more, this wasn't completely reliable, as not everything was using them
in a number of places. Memory management can still be overridden using tricks
like LD_PRELOAD if needed.
Their aligned equivilents cannot be deprecated, as no standard equivilents
exist, although investigation into posix_memalign(3) is a possibility
for the future.
Change-Id: Ic5f74b14be33f8bc188fe7236c55e15c36a23fc7
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Diffstat (limited to 'src/corelib/tools/qlist.h')
-rw-r--r-- | src/corelib/tools/qlist.h | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/corelib/tools/qlist.h b/src/corelib/tools/qlist.h index a15b0c9124..9d70e55b1e 100644 --- a/src/corelib/tools/qlist.h +++ b/src/corelib/tools/qlist.h @@ -55,6 +55,7 @@ #include <initializer_list> #endif +#include <stdlib.h> #include <new> #include <limits.h> #include <string.h> @@ -667,7 +668,7 @@ Q_OUTOFLINE_TEMPLATE typename QList<T>::Node *QList<T>::detach_helper_grow(int i node_copy(reinterpret_cast<Node *>(p.begin()), reinterpret_cast<Node *>(p.begin() + i), n); } QT_CATCH(...) { - qFree(d); + free(d); d = x; QT_RETHROW; } @@ -677,7 +678,7 @@ Q_OUTOFLINE_TEMPLATE typename QList<T>::Node *QList<T>::detach_helper_grow(int i } QT_CATCH(...) { node_destruct(reinterpret_cast<Node *>(p.begin()), reinterpret_cast<Node *>(p.begin() + i)); - qFree(d); + free(d); d = x; QT_RETHROW; } @@ -696,7 +697,7 @@ Q_OUTOFLINE_TEMPLATE void QList<T>::detach_helper(int alloc) QT_TRY { node_copy(reinterpret_cast<Node *>(p.begin()), reinterpret_cast<Node *>(p.end()), n); } QT_CATCH(...) { - qFree(d); + free(d); d = x; QT_RETHROW; } @@ -721,7 +722,7 @@ Q_OUTOFLINE_TEMPLATE QList<T>::QList(const QList<T> &l) struct Cleanup { Cleanup(QListData::Data *d) : d_(d) {} - ~Cleanup() { if (d_) qFree(d_); } + ~Cleanup() { if (d_) free(d_); } QListData::Data *d_; } tryCatch(d); @@ -763,7 +764,7 @@ Q_OUTOFLINE_TEMPLATE void QList<T>::dealloc(QListData::Data *data) { node_destruct(reinterpret_cast<Node *>(data->array + data->begin), reinterpret_cast<Node *>(data->array + data->end)); - qFree(data); + free(data); } |