Fix performance of wxHtmlParser::SkipCommentTag() in UTF-8 build.
Avoid computing the difference between two potentially distant iterators, which is O(1) in wchar_t build, but O(n) in UTF-8 one. See #13445. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@71370 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
2a715bcb3c
commit
e4f762f416
@ -957,12 +957,14 @@ wxHtmlParser::SkipCommentTag(wxString::const_iterator& start,
|
|||||||
|
|
||||||
wxString::const_iterator p = start;
|
wxString::const_iterator p = start;
|
||||||
|
|
||||||
// comments begin with "<!--" in HTML 4.0
|
// Comments begin with "<!--" in HTML 4.0; anything shorter or not containing
|
||||||
if ( end - start < 4 || *++p != '!' || *++p != '-' || *++p != '-' )
|
// these characters is not a comment and we're not going to skip it.
|
||||||
{
|
if ( ++p == end || *p != '!' )
|
||||||
// not a comment at all
|
return false;
|
||||||
return false;
|
if ( ++p == end || *p != '-' )
|
||||||
}
|
return false;
|
||||||
|
if ( ++p == end || *p != '-' )
|
||||||
|
return false;
|
||||||
|
|
||||||
// skip the start of the comment tag in any case, if we don't find the
|
// skip the start of the comment tag in any case, if we don't find the
|
||||||
// closing tag we should ignore broken markup
|
// closing tag we should ignore broken markup
|
||||||
|
Loading…
Reference in New Issue
Block a user