summaryrefslogtreecommitdiff
path: root/page.c
diff options
context:
space:
mode:
Diffstat (limited to 'page.c')
-rw-r--r--page.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/page.c b/page.c
index 1244df4..864623e 100644
--- a/page.c
+++ b/page.c
@@ -46,6 +46,13 @@ void split_page(struct page *back) {
back->next = front;
}
+void copy_page(struct page *dest, struct page *src) {
+ memcpy(dest->elements, src->elements, PAGE_SIZE);
+ dest->gap_start = src->gap_start;
+ dest->gap_end = src->gap_end;
+ dest->element_count = src->element_count;
+}
+
void free_page(struct page *page) {
if (page->prev) {
page->prev->next = page->next;
@@ -53,6 +60,7 @@ void free_page(struct page *page) {
if (page->next) {
page->next->prev = page->prev;
}
+ free(page->elements);
free(page);
}