Commit 67e65a79 authored by Max Kellermann's avatar Max Kellermann

page: added page_new_concat()

parent 47bbb73e
......@@ -51,6 +51,17 @@ page_new_copy(const void *data, size_t size)
return page;
}
struct page *
page_new_concat(const struct page *a, const struct page *b)
{
struct page *page = page_new(a->size + b->size);
memcpy(page->data, a->data, a->size);
memcpy(page->data + a->size, b->data, b->size);
return page;
}
void
page_ref(struct page *page)
{
......
......@@ -65,6 +65,15 @@ struct page *
page_new_copy(const void *data, size_t size);
/**
* Concatenates two pages to a new page.
*
* @param a the first page
* @param b the second page, which is appended
*/
struct page *
page_new_concat(const struct page *a, const struct page *b);
/**
* Increases the reference counter.
*
* @param page the #page object
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment