This commit is contained in:
Hongze Cheng 2022-03-14 03:02:21 +00:00
parent 40d18c4ac3
commit 77af8e6b5d
2 changed files with 8 additions and 0 deletions

View File

@ -20,6 +20,11 @@ typedef struct __attribute__((__packed__)) {
u16 nOffset;
} SFreeCell;
typedef struct __attribute__((__packed__)) {
u8 size[3];
u8 nOffset[3];
} SFreeCellL;
static int tdbPageAllocate(SPage *pPage, int size, SCell **ppCell);
static int tdbPageDefragment(SPage *pPage);
@ -46,9 +51,11 @@ int tdbPageCreate(int pageSize, SPage **ppPage, void *(*xMalloc)(void *, size_t)
if (pageSize < 65536) {
pPage->szOffset = 2;
pPage->szPageHdr = sizeof(SPageHdr);
pPage->szFreeCell = sizeof(SFreeCell);
} else {
pPage->szOffset = 3;
pPage->szPageHdr = sizeof(SLPageHdr);
pPage->szFreeCell = sizeof(SFreeCellL);
}
TDB_INIT_PAGE_LOCK(pPage);

View File

@ -50,6 +50,7 @@ struct SPage {
int pageSize;
u8 szOffset;
u8 szPageHdr;
u8 szFreeCell;
pthread_spinlock_t lock;
// Fields below used by pager and am
u8 *pPageHdr;