Bad, repeated node iteration! closes #459
This commit is contained in:
parent
92a872251b
commit
fd0ccb2bbf
10
src/parser.c
10
src/parser.c
|
@ -3851,7 +3851,15 @@ Bool TY_(FindNodeWithId)( Node *node, TidyTagId tid )
|
||||||
{
|
{
|
||||||
if (TagIsId(node,tid))
|
if (TagIsId(node,tid))
|
||||||
return yes;
|
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))
|
if (TY_(FindNodeWithId)(content,tid))
|
||||||
return yes;
|
return yes;
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
5.3.11
|
5.3.12
|
||||||
2016.09.11
|
2016.10.14
|
||||||
|
|
Loading…
Reference in New Issue