| 5127 | } |
| 5128 | |
| 5129 | PUGI__FN void xml_document::create() |
| 5130 | { |
| 5131 | // initialize sentinel page |
| 5132 | PUGI__STATIC_ASSERT(offsetof(impl::xml_memory_page, data) + sizeof(impl::xml_document_struct) + impl::xml_memory_page_alignment <= sizeof(_memory)); |
| 5133 | |
| 5134 | // align upwards to page boundary |
| 5135 | void* page_memory = reinterpret_cast<void*>((reinterpret_cast<uintptr_t>(_memory) + (impl::xml_memory_page_alignment - 1)) & ~(impl::xml_memory_page_alignment - 1)); |
| 5136 | |
| 5137 | // prepare page structure |
| 5138 | impl::xml_memory_page* page = impl::xml_memory_page::construct(page_memory); |
| 5139 | |
| 5140 | page->busy_size = impl::xml_memory_page_size; |
| 5141 | |
| 5142 | // allocate new root |
| 5143 | _root = new (page->data) impl::xml_document_struct(page); |
| 5144 | _root->prev_sibling_c = _root; |
| 5145 | |
| 5146 | // setup sentinel page |
| 5147 | page->allocator = static_cast<impl::xml_document_struct*>(_root); |
| 5148 | } |
| 5149 | |
| 5150 | PUGI__FN void xml_document::destroy() |
| 5151 | { |
no outgoing calls