Add page cloning

master
Yury Kurlykov 2019-10-31 03:03:40 +10:00
parent 6bfa43da67
commit 918a2a0192
2 changed files with 15 additions and 0 deletions

View File

@ -104,6 +104,15 @@ YDB_PageSize ydb_page_row_count_get(YDB_TablePage* page);
*/ */
void ydb_page_row_count_set(YDB_TablePage* page, YDB_PageSize row_count); void ydb_page_row_count_set(YDB_TablePage* page, YDB_PageSize row_count);
/**
* @brief Clone a page.
* @param page A page to clone.
* @return A cloned page.
*
* Notice that you should deallocate it with ydb_page_free().
*/
YDB_TablePage* ydb_page_clone(const YDB_TablePage* page);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View File

@ -115,6 +115,12 @@ void ydb_page_row_count_set(YDB_TablePage *page, YDB_PageSize row_count) {
page->row_count = row_count; page->row_count = row_count;
} }
YDB_TablePage *ydb_page_clone(const YDB_TablePage *page) {
YDB_TablePage* result = malloc(sizeof(YDB_TablePage));
memcpy(result, page, sizeof(YDB_TablePage));
return result;
}
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif