From b67f104498393f60f701a6bef219d0f34ece6f51 Mon Sep 17 00:00:00 2001 From: "arseny.kapoulkine" Date: Wed, 1 Sep 2010 17:08:48 +0000 Subject: XPath: Minor refactoring git-svn-id: http://pugixml.googlecode.com/svn/trunk@715 99668b35-9821-0410-8761-19e4c4f06640 --- src/pugixml.cpp | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/pugixml.cpp b/src/pugixml.cpp index 0e519a4..a8ed526 100644 --- a/src/pugixml.cpp +++ b/src/pugixml.cpp @@ -7684,7 +7684,7 @@ namespace pugi struct xpath_parser { - xpath_allocator& _alloc; + xpath_allocator* _alloc; xpath_lexer _lexer; const char_t* _query; @@ -7696,9 +7696,6 @@ namespace pugi jmp_buf _error_handler; #endif - xpath_parser(const xpath_parser&); - xpath_parser& operator=(const xpath_parser&); - void throw_error(const char* message) { _result->error = message; @@ -7713,7 +7710,7 @@ namespace pugi void* alloc_node() { - void* result = _alloc.allocate(sizeof(xpath_ast_node)); + void* result = _alloc->allocate(sizeof(xpath_ast_node)); if (!result) throw_error("Out of memory"); @@ -7726,7 +7723,7 @@ namespace pugi { size_t length = static_cast(value.end - value.begin); - char_t* c = static_cast(_alloc.allocate((length + 1) * sizeof(char_t))); + char_t* c = static_cast(_alloc->allocate((length + 1) * sizeof(char_t))); if (!c) throw_error("Out of memory"); memcpy(c, value.begin, length * sizeof(char_t)); @@ -8499,7 +8496,7 @@ namespace pugi return parse_or_expression(); } - xpath_parser(const char_t* query, xpath_variable_set* variables, xpath_allocator& alloc, xpath_parse_result* result): _alloc(alloc), _lexer(query), _query(query), _variables(variables), _result(result) + xpath_parser(const char_t* query, xpath_variable_set* variables, xpath_allocator* alloc, xpath_parse_result* result): _alloc(alloc), _lexer(query), _query(query), _variables(variables), _result(result) { } @@ -8516,7 +8513,7 @@ namespace pugi return result; } - static xpath_ast_node* parse(const char_t* query, xpath_variable_set* variables, xpath_allocator& alloc, xpath_parse_result* result) + static xpath_ast_node* parse(const char_t* query, xpath_variable_set* variables, xpath_allocator* alloc, xpath_parse_result* result) { xpath_parser parser(query, variables, alloc, result); @@ -8736,7 +8733,7 @@ namespace pugi { buffer_holder alloc_holder(alloc, xpath_allocator::destroy); - _root = xpath_parser::parse(query, variables, *alloc, &_result); + _root = xpath_parser::parse(query, variables, alloc, &_result); #ifdef PUGIXML_NO_EXCEPTIONS if (_root) // only store allocator if parsing was a success -- cgit v1.2.3