From e4c43a0aa2d5cbc158dd279cb2bf6d21f2d27c83 Mon Sep 17 00:00:00 2001 From: Arseny Kapoulkine Date: Mon, 7 Nov 2016 19:29:52 -0800 Subject: Move compact hash table pointer setup to xml_document This keeps all code that creates document/allocator/page structures together. --- src/pugixml.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/pugixml.cpp b/src/pugixml.cpp index 0510afa..600a223 100644 --- a/src/pugixml.cpp +++ b/src/pugixml.cpp @@ -1119,9 +1119,6 @@ PUGI__NS_BEGIN { xml_document_struct(xml_memory_page* page): xml_node_struct(page, node_document), xml_allocator(page), buffer(0), extra_buffers(0) { - #ifdef PUGIXML_COMPACT - _hash = &hash; - #endif } const char_t* buffer; @@ -6861,6 +6858,11 @@ namespace pugi // setup sentinel page page->allocator = static_cast(_root); + // setup hash table pointer in allocator + #ifdef PUGIXML_COMPACT + page->allocator->_hash = &static_cast(_root)->hash; + #endif + // verify the document allocation assert(reinterpret_cast(_root) + sizeof(impl::xml_document_struct) <= _memory + sizeof(_memory)); } -- cgit v1.2.3