diff options
author | arseny.kapoulkine <arseny.kapoulkine@99668b35-9821-0410-8761-19e4c4f06640> | 2010-10-22 19:08:46 +0000 |
---|---|---|
committer | arseny.kapoulkine <arseny.kapoulkine@99668b35-9821-0410-8761-19e4c4f06640> | 2010-10-22 19:08:46 +0000 |
commit | 0e73657345916a075a467a65b66700b14b0e85bd (patch) | |
tree | 2e0d499dcedc5ee66a637344a1a2a4a5ab69ac88 /src | |
parent | 59c88d72367d12ef5dad5aaedd0a84a23ec3975f (diff) |
XPath: Minor refactoring
git-svn-id: http://pugixml.googlecode.com/svn/trunk@776 99668b35-9821-0410-8761-19e4c4f06640
Diffstat (limited to 'src')
-rw-r--r-- | src/pugixml.cpp | 20 |
1 files changed, 9 insertions, 11 deletions
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<xpath_memory_block*>(static_cast<xpath_query_impl*>(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) |