summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArseny Kapoulkine <arseny.kapoulkine@gmail.com>2015-07-22 21:06:39 -0700
committerArseny Kapoulkine <arseny.kapoulkine@gmail.com>2015-07-22 21:07:44 -0700
commit4460da54a17e8403f47a2cc152e72bc209dde264 (patch)
treeda08521d56b5715be5e525c4631f7152c00bd27f
parentd4fedd6775143568eb48af46e78daaeb11a7a023 (diff)
XPath: Split optimize into optimize and optimize_self
This makes the code slightly more readable, but more importantly it fixes a false positive in Clang static analyzer. Fixes #47.
-rw-r--r--src/pugixml.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/pugixml.cpp b/src/pugixml.cpp
index 0d762a7..20d8ca7 100644
--- a/src/pugixml.cpp
+++ b/src/pugixml.cpp
@@ -10660,6 +10660,11 @@ PUGI__NS_BEGIN
if (_right) _right->optimize(alloc);
if (_next) _next->optimize(alloc);
+ optimize_self(alloc);
+ }
+
+ void optimize_self(xpath_allocator* alloc)
+ {
// Rewrite [position()=expr] with [expr]
// Note that this step has to go before classification to recognize [position()=1]
if ((_type == ast_filter || _type == ast_predicate) &&