diff options
author | Arseny Kapoulkine <arseny.kapoulkine@gmail.com> | 2016-11-07 19:29:52 -0800 |
---|---|---|
committer | Arseny Kapoulkine <arseny.kapoulkine@gmail.com> | 2016-11-07 19:31:34 -0800 |
commit | e4c43a0aa2d5cbc158dd279cb2bf6d21f2d27c83 (patch) | |
tree | 0bf0561eb592e5cadc2ea90f4d959e9a149e4144 | |
parent | 9bc497267b23470e71dafee69d7ff8a191f21817 (diff) |
Move compact hash table pointer setup to xml_document
This keeps all code that creates document/allocator/page structures together.
-rw-r--r-- | src/pugixml.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
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<impl::xml_document_struct*>(_root); + // setup hash table pointer in allocator + #ifdef PUGIXML_COMPACT + page->allocator->_hash = &static_cast<impl::xml_document_struct*>(_root)->hash; + #endif + // verify the document allocation assert(reinterpret_cast<char*>(_root) + sizeof(impl::xml_document_struct) <= _memory + sizeof(_memory)); } |