| 4514 | } |
| 4515 | |
| 4516 | void xml_document::create() |
| 4517 | { |
| 4518 | // initialize sentinel page |
| 4519 | STATIC_ASSERT(offsetof(xml_memory_page, data) + sizeof(xml_document_struct) + xml_memory_page_alignment <= sizeof(_memory)); |
| 4520 | |
| 4521 | // align upwards to page boundary |
| 4522 | void* page_memory = reinterpret_cast<void*>((reinterpret_cast<uintptr_t>(_memory) + (xml_memory_page_alignment - 1)) & ~(xml_memory_page_alignment - 1)); |
| 4523 | |
| 4524 | // prepare page structure |
| 4525 | xml_memory_page* page = xml_memory_page::construct(page_memory); |
| 4526 | |
| 4527 | page->busy_size = xml_memory_page_size; |
| 4528 | |
| 4529 | // allocate new root |
| 4530 | _root = new (page->data) xml_document_struct(page); |
| 4531 | _root->prev_sibling_c = _root; |
| 4532 | |
| 4533 | // setup sentinel page |
| 4534 | page->allocator = static_cast<xml_document_struct*>(_root); |
| 4535 | } |
| 4536 | |
| 4537 | void xml_document::destroy() |
| 4538 | { |
no test coverage detected