page: added page_new_concat()

This commit is contained in:
Max Kellermann 2009-03-17 20:51:33 +01:00
parent 47bbb73ee1
commit 67e65a7959
2 changed files with 20 additions and 0 deletions

View File

@ -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)
{

View File

@ -64,6 +64,15 @@ struct page {
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.
*