| 5707 | } |
| 5708 | |
| 5709 | PUGI__FN void xml_document::create() |
| 5710 | { |
| 5711 | // initialize sentinel page |
| 5712 | PUGI__STATIC_ASSERT( |
| 5713 | offsetof(impl::xml_memory_page, data) + sizeof(impl::xml_document_struct) + |
| 5714 | impl::xml_memory_page_alignment <= |
| 5715 | sizeof(_memory)); |
| 5716 | |
| 5717 | // align upwards to page boundary |
| 5718 | void* page_memory = reinterpret_cast<void*>( |
| 5719 | (reinterpret_cast<uintptr_t>(_memory) + (impl::xml_memory_page_alignment - 1)) & |
| 5720 | ~(impl::xml_memory_page_alignment - 1)); |
| 5721 | |
| 5722 | // prepare page structure |
| 5723 | impl::xml_memory_page* page = impl::xml_memory_page::construct(page_memory); |
| 5724 | |
| 5725 | page->busy_size = impl::xml_memory_page_size; |
| 5726 | |
| 5727 | // allocate new root |
| 5728 | _root = new (page->data) impl::xml_document_struct(page); |
| 5729 | _root->prev_sibling_c = _root; |
| 5730 | |
| 5731 | // setup sentinel page |
| 5732 | page->allocator = static_cast<impl::xml_document_struct*>(_root); |
| 5733 | } |
| 5734 | |
| 5735 | PUGI__FN void xml_document::destroy() |
| 5736 | { |
no outgoing calls
no test coverage detected