page: added page_new_concat()
This commit is contained in:
parent
47bbb73ee1
commit
67e65a7959
11
src/page.c
11
src/page.c
@ -51,6 +51,17 @@ page_new_copy(const void *data, size_t size)
|
|||||||
return page;
|
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
|
void
|
||||||
page_ref(struct page *page)
|
page_ref(struct page *page)
|
||||||
{
|
{
|
||||||
|
@ -64,6 +64,15 @@ struct page {
|
|||||||
struct page *
|
struct page *
|
||||||
page_new_copy(const void *data, size_t size);
|
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.
|
* Increases the reference counter.
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user