Bad, repeated node iteration! closes #459

This commit is contained in:
Geoff McLane 2016-10-30 23:37:31 +01:00
parent 92a872251b
commit fd0ccb2bbf
2 changed files with 11 additions and 3 deletions

View file

@ -3851,7 +3851,15 @@ Bool TY_(FindNodeWithId)( Node *node, TidyTagId tid )
{
if (TagIsId(node,tid))
return yes;
for (content = node->content; content; content = content->content)
/*\
* Issue #459 - Under certain circumstances, with many node this use of
* 'for (content = node->content; content; content = content->content)'
* would produce a **forever** circle, or at least a very extended loop...
* It is sufficient to test the content, if it exists,
* to quickly iterate all nodes. Now all nodes are tested only once.
\*/
content = node->content;
if (content)
{
if (TY_(FindNodeWithId)(content,tid))
return yes;

View file

@ -1,2 +1,2 @@
5.3.11
2016.09.11
5.3.12
2016.10.14