From 0e73657345916a075a467a65b66700b14b0e85bd Mon Sep 17 00:00:00 2001 From: "arseny.kapoulkine" Date: Fri, 22 Oct 2010 19:08:46 +0000 Subject: XPath: Minor refactoring git-svn-id: http://pugixml.googlecode.com/svn/trunk@776 99668b35-9821-0410-8761-19e4c4f06640 --- src/pugixml.cpp | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/pugixml.cpp b/src/pugixml.cpp index 192f224..7ebba5c 100644 --- a/src/pugixml.cpp +++ b/src/pugixml.cpp @@ -5000,6 +5000,10 @@ namespace size_t _root_size; public: + #ifdef PUGIXML_NO_EXCEPTIONS + jmp_buf* error_handler; + #endif + xpath_allocator(xpath_memory_block* root, size_t root_size = 0): _root(root), _root_size(root_size) { #ifdef PUGIXML_NO_EXCEPTIONS @@ -5132,10 +5136,6 @@ namespace cur = next; } } - - #ifdef PUGIXML_NO_EXCEPTIONS - jmp_buf* error_handler; - #endif }; struct xpath_allocator_capture @@ -9298,13 +9298,9 @@ namespace pugi { static xpath_query_impl* create() { - void* memory = global_allocate(sizeof(xpath_query_impl) + sizeof(xpath_memory_block)); - if (!memory) return 0; - - xpath_memory_block* root = reinterpret_cast(static_cast(memory) + 1); - root->next = 0; + void* memory = global_allocate(sizeof(xpath_query_impl)); - return new (memory) xpath_query_impl(root); + return new (memory) xpath_query_impl(); } static void destroy(void* ptr) @@ -9318,12 +9314,14 @@ namespace pugi global_deallocate(ptr); } - xpath_query_impl(xpath_memory_block* block): root(0), alloc(block) + xpath_query_impl(): root(0), alloc(&block) { + block.next = 0; } xpath_ast_node* root; xpath_allocator alloc; + xpath_memory_block block; }; xpath_query::xpath_query(const char_t* query, xpath_variable_set* variables): _impl(0) -- cgit v1.2.3