SVN commit 720995 by amantia: Make the parser as fast as it was in 3.5.6 and before, but keep the double deletion checks. M +1 -0 ChangeLog M +17 -16 parsers/node.cpp M +2 -2 parsers/parser.cpp --- branches/KDE/3.5/kdewebdev/quanta/ChangeLog #720994:720995 @@ -7,6 +7,7 @@ - do not lose CSS selectors after editing inside the dialog if they are repeated [#145413] - avoid crashes in various (random) cases + - make the parser as fast as it was in 3.5.6 and before Version 3.5.7 (Release date: xx-xx-2006; Started 06-02-2006) --- branches/KDE/3.5/kdewebdev/quanta/parsers/node.cpp #720994:720995 @@ -27,7 +27,7 @@ #include "structtreetag.h" #include "kafkacommon.h" -QValueList nodes; //list of all created nodes. Used to do some own memory management and avoid double deletes, for whatever reason they happen... +QMap nodes; //list of all created nodes. Used to do some own memory management and avoid double deletes, for whatever reason they happen... int NN = 0; //for debugging purposes: count the Node objects @@ -48,19 +48,21 @@ m_leafNode = 0L; m_groupElements.clear(); NN++; - if (nodes.contains(this) == 0) - nodes.append(this); - else - { - kdError(24000) << "A node with this address " << this << " already exists!" << endl; - } +// if (nodes.contains(this) == 0) + nodes[this] = 1; +// else +// { +// kdError(24000) << "A node with this address " << this << " already exists!" << endl; +// } } bool Node::deleteNode(Node *node) { - if (nodes.contains(node) == 0) + if (!node) + return true; + if (!nodes.contains(node)) { - //kdDebug(24000) << "Trying to delete a node with address " << node << " that was not allocated!" << endl; + kdDebug(24000) << "Trying to delete a node with address " << node << " that was not allocated!" << endl; return false; } delete node; @@ -69,11 +71,11 @@ Node::~Node() { - if (nodes.contains(this) == 0) - { - kdError(24000) << "No node with this address " << this << " was allocated!" << endl; - return; - } +// if (!nodes.contains(this)) +// { +// kdError(24000) << "No node with this address " << this << " was allocated!" << endl; +// return; +// } //It has no use, except to know when it crash why it has crashed. //If it has crashed here, the Node doesn't exist anymore. @@ -84,8 +86,7 @@ tag->setCleanStrBuilt(false); detachNode(); - if (nodes.contains(this) > 0) - nodes.remove(this); + nodes.erase(this); if (prev && prev->next == this) prev->next = 0L; if (parent && parent->child == this) --- branches/KDE/3.5/kdewebdev/quanta/parsers/parser.cpp #720994:720995 @@ -1215,8 +1215,8 @@ } node = lastNode; lastNode = lastNode->nextNotChild(); - if (lastNode) - QString s = lastNode->tag->tagStr(); +/* if (lastNode) + QString s = lastNode->tag->tagStr();*/ } } /* kdDebug(24000)<< "END"<< endl;