diff options
| -rw-r--r-- | src/pugixml.hpp | 2 | ||||
| -rw-r--r-- | src/pugixpath.cpp | 18 | 
2 files changed, 7 insertions, 13 deletions
diff --git a/src/pugixml.hpp b/src/pugixml.hpp index 6a5f7e4..d79d128 100644 --- a/src/pugixml.hpp +++ b/src/pugixml.hpp @@ -369,8 +369,6 @@ namespace pugi  		xpath_allocator* m_alloc;  		xpath_ast_node* m_root; -		void compile(const char_t* query); -  	public:  		/**  		 * Constructor from string with XPath expression. diff --git a/src/pugixpath.cpp b/src/pugixpath.cpp index e9b7bc0..56775af 100644 --- a/src/pugixpath.cpp +++ b/src/pugixpath.cpp @@ -49,6 +49,7 @@ typedef __int32 int32_t;  #endif  #include <algorithm> +#include <memory>  #include <string>  // String utilities prototypes @@ -3359,22 +3360,17 @@ namespace pugi  	xpath_query::xpath_query(const char_t* query): m_alloc(0), m_root(0)  	{ -		compile(query); -	} +		std::auto_ptr<xpath_allocator> alloc(new xpath_allocator); -	xpath_query::~xpath_query() -	{ -		delete m_alloc; +		xpath_parser p(query, *alloc); + +		m_root = p.parse(); +		m_alloc = alloc.release();  	} -	void xpath_query::compile(const char_t* query) +	xpath_query::~xpath_query()  	{  		delete m_alloc; -		m_alloc = new xpath_allocator; - -		xpath_parser p(query, *m_alloc); - -		m_root = p.parse();  	}  	xpath_value_type xpath_query::return_type() const  | 
