Changeset 561 for trunk/src/corelib/tools/qmap.cpp
- Timestamp:
- Feb 11, 2010, 11:19:06 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
-
Property svn:mergeinfo
set to (toggle deleted branches)
/branches/vendor/nokia/qt/4.6.1 merged eligible /branches/vendor/nokia/qt/current merged eligible /branches/vendor/trolltech/qt/current 3-149
-
Property svn:mergeinfo
set to (toggle deleted branches)
-
trunk/src/corelib/tools/qmap.cpp
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information ([email protected]) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation ([email protected]) 5 6 ** 6 7 ** This file is part of the QtCore module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you 37 ** @nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 54 54 &shared_null, 55 55 { &shared_null, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 56 Q_BASIC_ATOMIC_INITIALIZER(1), 0, 0, 0, false, true 56 Q_BASIC_ATOMIC_INITIALIZER(1), 0, 0, 0, false, true 57 57 }; 58 58 59 59 QMapData *QMapData::createData() 60 60 { 61 62 63 64 65 61 66 QMapData *d = new QMapData; 67 62 68 Node *e = reinterpret_cast<Node *>(d); 63 69 e->backward = e; … … 69 75 d->insertInOrder = false; 70 76 d->sharable = true; 77 78 71 79 return d; 72 80 } … … 80 88 prev = cur; 81 89 cur = cur->forward[0]; 82 qFree(reinterpret_cast<char *>(prev) - offset); 90 if (strictAlignment) 91 qFreeAligned(reinterpret_cast<char *>(prev) - offset); 92 else 93 qFree(reinterpret_cast<char *>(prev) - offset); 83 94 } 84 95 delete this; … … 86 97 87 98 QMapData::Node *QMapData::node_create(Node *update[], int offset) 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 88 118 { 89 119 int level = 0; … … 94 124 mask <<= Sparseness; 95 125 } 96 97 ++randomBits;98 if (level == 3 && !insertInOrder)99 randomBits = qrand();100 126 101 127 if (level > topLevel) { … … 106 132 } 107 133 108 void *concreteNode = qMalloc(offset + sizeof(Node) + level * sizeof(Node *)); 134 ++randomBits; 135 if (level == 3 && !insertInOrder) 136 randomBits = qrand(); 137 138 void *concreteNode = strictAlignment ? 139 qMallocAligned(offset + sizeof(Node) + level * sizeof(Node *), alignment) : 140 qMalloc(offset + sizeof(Node) + level * sizeof(Node *)); 141 Q_CHECK_PTR(concreteNode); 142 109 143 Node *abstractNode = reinterpret_cast<Node *>(reinterpret_cast<char *>(concreteNode) + offset); 110 144 … … 131 165 } 132 166 --size; 133 qFree(reinterpret_cast<char *>(node) - offset); 167 if (strictAlignment) 168 qFreeAligned(reinterpret_cast<char *>(node) - offset); 169 else 170 qFree(reinterpret_cast<char *>(node) - offset); 134 171 } 135 172 … … 147 184 void QMapData::dump() 148 185 { 149 qDebug("Map data (ref = %d, size = %d, randomBits = %#.8x)", ref.atomic, size, randomBits);186 qDebug("Map data (ref = %d, size = %d, randomBits = %#.8x)", , size, randomBits); 150 187 151 188 QString preOutput; … … 159 196 Node *update[LastLevel + 1]; 160 197 for (int i = 0; i <= topLevel; ++i) { 161 str.sprintf("%d: [%.8x] -", i, adjust_ptr( forward[i]));198 str.sprintf("%d: [%.8x] -", i, adjust_ptr()); 162 199 output[i] += str; 163 update[i] = forward[i];200 update[i] = ; 164 201 } 165 202 166 Node *node = forward[0];203 Node *node = ; 167 204 while (node != e) { 168 205 int level = 0; … … 179 216 } 180 217 for (int j = level + 1; j <= topLevel; ++j) 181 output[j] += "---------------";218 output[j] += ; 182 219 node = node->forward[0]; 183 220 } 184 221 185 qDebug( preOutput.ascii());222 qDebug(preOutput.ascii()); 186 223 for (int i = 0; i <= topLevel; ++i) 187 qDebug( output[i].ascii());224 qDebug(output[i].ascii()); 188 225 } 189 226 #endif … … 195 232 \ingroup tools 196 233 \ingroup shared 197 \mainclass 234 198 235 \reentrant 199 236 … … 903 940 /*! \typedef QMap::iterator::iterator_category 904 941 905 \internal 942 A synonym for \e {std::bidirectional_iterator_tag} indicating 943 this iterator is a bidirectional iterator. 906 944 */ 907 945 … … 1124 1162 /*! \typedef QMap::const_iterator::iterator_category 1125 1163 1126 \internal 1164 A synonym for \e {std::bidirectional_iterator_tag} indicating 1165 this iterator is a bidirectional iterator. 1127 1166 */ 1128 1167 … … 1316 1355 \ingroup tools 1317 1356 \ingroup shared 1318 \mainclass 1357 1319 1358 \reentrant 1320 1359
Note:
See TracChangeset
for help on using the changeset viewer.