More branch probability tuning
git-svn-id: http://pugixml.googlecode.com/svn/trunk@236 99668b35-9821-0410-8761-19e4c4f06640
This commit is contained in:
parent
8a2b1b6e7a
commit
a3c386c4bd
@ -692,7 +692,13 @@ namespace
|
|||||||
{
|
{
|
||||||
while (!is_chartype(*s, ct_parse_pcdata)) ++s;
|
while (!is_chartype(*s, ct_parse_pcdata)) ++s;
|
||||||
|
|
||||||
if (opt_eol && *s == '\r') // Either a single 0x0d or 0x0d 0x0a pair
|
if (*s == '<') // PCDATA ends here
|
||||||
|
{
|
||||||
|
*g.flush(s) = 0;
|
||||||
|
|
||||||
|
return s + 1;
|
||||||
|
}
|
||||||
|
else if (opt_eol && *s == '\r') // Either a single 0x0d or 0x0d 0x0a pair
|
||||||
{
|
{
|
||||||
*s++ = '\n'; // replace first one with 0x0a
|
*s++ = '\n'; // replace first one with 0x0a
|
||||||
|
|
||||||
@ -702,12 +708,6 @@ namespace
|
|||||||
{
|
{
|
||||||
s = strconv_escape(s, g);
|
s = strconv_escape(s, g);
|
||||||
}
|
}
|
||||||
else if (*s == '<') // PCDATA ends here
|
|
||||||
{
|
|
||||||
*g.flush(s) = 0;
|
|
||||||
|
|
||||||
return s + 1;
|
|
||||||
}
|
|
||||||
else if (*s == 0)
|
else if (*s == 0)
|
||||||
{
|
{
|
||||||
return s;
|
return s;
|
||||||
@ -741,22 +741,35 @@ namespace
|
|||||||
|
|
||||||
gap g;
|
gap g;
|
||||||
|
|
||||||
// Trim whitespaces
|
// trim leading whitespaces
|
||||||
if (opt_wnorm)
|
if (opt_wnorm && is_chartype(*s, ct_space))
|
||||||
{
|
{
|
||||||
char* str = s;
|
char* str = s;
|
||||||
|
|
||||||
while (is_chartype(*str, ct_space)) ++str;
|
do ++str;
|
||||||
|
while (is_chartype(*str, ct_space));
|
||||||
|
|
||||||
if (str != s)
|
g.push(s, str - s);
|
||||||
g.push(s, str - s);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
while (!is_chartype(*s, (opt_wnorm || opt_wconv) ? ct_parse_attr_ws : ct_parse_attr)) ++s;
|
while (!is_chartype(*s, (opt_wnorm || opt_wconv) ? ct_parse_attr_ws : ct_parse_attr)) ++s;
|
||||||
|
|
||||||
if (opt_wnorm && is_chartype(*s, ct_space))
|
if (*s == end_quote)
|
||||||
|
{
|
||||||
|
char* str = g.flush(s);
|
||||||
|
|
||||||
|
if (opt_wnorm)
|
||||||
|
{
|
||||||
|
do *str-- = 0;
|
||||||
|
while (is_chartype(*str, ct_space));
|
||||||
|
}
|
||||||
|
else *str = 0;
|
||||||
|
|
||||||
|
return s + 1;
|
||||||
|
}
|
||||||
|
else if (opt_wnorm && is_chartype(*s, ct_space))
|
||||||
{
|
{
|
||||||
*s++ = ' ';
|
*s++ = ' ';
|
||||||
|
|
||||||
@ -788,19 +801,6 @@ namespace
|
|||||||
|
|
||||||
if (*s == '\n') g.push(s, 1);
|
if (*s == '\n') g.push(s, 1);
|
||||||
}
|
}
|
||||||
else if (*s == end_quote)
|
|
||||||
{
|
|
||||||
char* str = g.flush(s);
|
|
||||||
|
|
||||||
if (opt_wnorm)
|
|
||||||
{
|
|
||||||
do *str-- = 0;
|
|
||||||
while (is_chartype(*str, ct_space));
|
|
||||||
}
|
|
||||||
else *str = 0;
|
|
||||||
|
|
||||||
return s + 1;
|
|
||||||
}
|
|
||||||
else if (opt_escape && *s == '&')
|
else if (opt_escape && *s == '&')
|
||||||
{
|
{
|
||||||
s = strconv_escape(s, g);
|
s = strconv_escape(s, g);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user