From 261f589f4714de7eb8f1f69a0f130dc9f498e932 Mon Sep 17 00:00:00 2001 From: jez <> Date: Sun, 4 May 2008 14:41:23 +0000 Subject: [PATCH] --- include/XPath/impl/xpath_step.hpp | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/include/XPath/impl/xpath_step.hpp b/include/XPath/impl/xpath_step.hpp index 4a87376d..12ab344b 100644 --- a/include/XPath/impl/xpath_step.hpp +++ b/include/XPath/impl/xpath_step.hpp @@ -219,17 +219,16 @@ public: Axis axis, bool is_attr = false) { - NodeTest* test = getTest(node, end, !is_attr ? axis : ATTRIBUTE, context.namespaceContext()); - XPathExpression_impl* thing = 0; - if(!test) - thing = XPath::compile_expression(node++, end, context); + std::auto_ptr > test(getTest(node, end, !is_attr ? axis : ATTRIBUTE, context.namespaceContext())); + std::auto_ptr > thing; + if(test.get() == 0) + thing.reset(XPath::compile_expression(node++, end, context)); - std::vector*> preds = - createPredicates(node, end, context); + std::vector*> preds = createPredicates(node, end, context); - if(!test) - return new ExprStepExpression(thing, preds); - return new TestStepExpression(axis, test, preds); + if(test.get() == 0) + return new ExprStepExpression(thing.release(), preds); + return new TestStepExpression(axis, test.release(), preds); } // createStep static StepExpression* createFilter(const typename types::node_iter_t& node,