Rename QMapData::free to destroy
authorThiago Macieira <thiago.macieira@intel.com>
Wed, 8 Aug 2012 13:02:30 +0000 (15:02 +0200)
committerQt by Nokia <qt-info@nokia.com>
Thu, 9 Aug 2012 01:26:10 +0000 (03:26 +0200)
The convention for QMap is that "free" methods simply free memory and
that "destroy" ones also run destructors of types affected. Since this
function calls destroySubTree, it should be more properly called
"destroy".

This also gets rid of another function called simply "free" in our
headers.

Change-Id: I3fa621c78848ede33dd5b78428c704d0423ba4e7
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
src/corelib/tools/qmap.h

index 9cab103..af3df21 100644 (file)
@@ -231,7 +231,7 @@ struct QMapData : public QMapDataBase
         return static_cast<QMapData *>(createData());
     }
 
-    void free() {
+    void destroy() {
         if (root()) {
             root()->destroySubTree();
             freeTree(header.left, Q_ALIGNOF(Node));
@@ -331,7 +331,7 @@ public:
     inline QMap() : d(static_cast<QMapData<Key, T> *>(const_cast<QMapDataBase *>(&QMapDataBase::shared_null))) { }
     QMap(const QMap<Key, T> &other);
 
-    inline ~QMap() { if (!d->ref.deref()) d->free(); }
+    inline ~QMap() { if (!d->ref.deref()) d->destroy(); }
 
     QMap<Key, T> &operator=(const QMap<Key, T> &other);
 #ifdef Q_COMPILER_RVALUE_REFS
@@ -782,7 +782,7 @@ Q_OUTOFLINE_TEMPLATE void QMap<Key, T>::detach_helper()
         x->header.left->setParent(&x->header);
     }
     if (!d->ref.deref())
-        d->free();
+        d->destroy();
     d = x;
 }