summaryrefslogtreecommitdiff
path: root/src/pugixml.cpp
diff options
context:
space:
mode:
authorarseny.kapoulkine <arseny.kapoulkine@99668b35-9821-0410-8761-19e4c4f06640>2009-11-10 11:26:42 +0000
committerarseny.kapoulkine <arseny.kapoulkine@99668b35-9821-0410-8761-19e4c4f06640>2009-11-10 11:26:42 +0000
commita3c386c4bd71ba45bb14c69923ec17860a5c7c6f (patch)
tree6ade3347792bf0bc389e8eed8ba18905ae69c4be /src/pugixml.cpp
parent8a2b1b6e7a38718c63a5f50945b5f63bc02aed50 (diff)
More branch probability tuning
git-svn-id: http://pugixml.googlecode.com/svn/trunk@236 99668b35-9821-0410-8761-19e4c4f06640
Diffstat (limited to 'src/pugixml.cpp')
-rw-r--r--src/pugixml.cpp52
1 files changed, 26 insertions, 26 deletions
diff --git a/src/pugixml.cpp b/src/pugixml.cpp
index 7114747..0a50497 100644
--- a/src/pugixml.cpp
+++ b/src/pugixml.cpp
@@ -692,7 +692,13 @@ namespace
{
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
@@ -702,12 +708,6 @@ namespace
{
s = strconv_escape(s, g);
}
- else if (*s == '<') // PCDATA ends here
- {
- *g.flush(s) = 0;
-
- return s + 1;
- }
else if (*s == 0)
{
return s;
@@ -741,22 +741,35 @@ namespace
gap g;
- // Trim whitespaces
- if (opt_wnorm)
+ // trim leading whitespaces
+ if (opt_wnorm && is_chartype(*s, ct_space))
{
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 (!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++ = ' ';
@@ -788,19 +801,6 @@ namespace
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 == '&')
{
s = strconv_escape(s, g);