diff options
author | arseny.kapoulkine <arseny.kapoulkine@99668b35-9821-0410-8761-19e4c4f06640> | 2010-09-01 17:08:48 +0000 |
---|---|---|
committer | arseny.kapoulkine <arseny.kapoulkine@99668b35-9821-0410-8761-19e4c4f06640> | 2010-09-01 17:08:48 +0000 |
commit | b67f104498393f60f701a6bef219d0f34ece6f51 (patch) | |
tree | e919f523cbcb528af1ce487170c1ec61baad4907 | |
parent | 42517f26a9f145fd2c1759b77218f28b11a9ee1a (diff) |
XPath: Minor refactoring
git-svn-id: http://pugixml.googlecode.com/svn/trunk@715 99668b35-9821-0410-8761-19e4c4f06640
-rw-r--r-- | src/pugixml.cpp | 15 |
1 files changed, 6 insertions, 9 deletions
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<size_t>(value.end - value.begin); - char_t* c = static_cast<char_t*>(_alloc.allocate((length + 1) * sizeof(char_t))); + char_t* c = static_cast<char_t*>(_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 |