summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
2a715bc)
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
wxString::const_iterator p = start;
wxString::const_iterator p = start;
- // comments begin with "<!--" in HTML 4.0
- if ( end - start < 4 || *++p != '!' || *++p != '-' || *++p != '-' )
- {
- // not a comment at all
- return false;
- }
+ // Comments begin with "<!--" in HTML 4.0; anything shorter or not containing
+ // these characters is not a comment and we're not going to skip it.
+ if ( ++p == end || *p != '!' )
+ 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
// closing tag we should ignore broken markup
// skip the start of the comment tag in any case, if we don't find the
// closing tag we should ignore broken markup