refact
This commit is contained in:
parent
d622916529
commit
f4a863e52e
|
@ -112,7 +112,6 @@ int tdbBtreeCursor(SBtCursor *pCur, SBTree *pBt) {
|
|||
int tdbBtCursorInsert(SBtCursor *pCur, const void *pKey, int kLen, const void *pVal, int vLen) {
|
||||
int ret;
|
||||
SPager * pPager;
|
||||
SBtPage *pPage;
|
||||
|
||||
ret = tdbBtCursorMoveTo(pCur, pKey, kLen);
|
||||
if (ret < 0) {
|
||||
|
@ -120,20 +119,17 @@ int tdbBtCursorInsert(SBtCursor *pCur, const void *pKey, int kLen, const void *p
|
|||
return -1;
|
||||
}
|
||||
|
||||
pPage = pCur->pPage;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int tdbBtCursorMoveTo(SBtCursor *pCur, const void *pKey, int kLen) {
|
||||
int ret;
|
||||
SBtPage *pBtPage;
|
||||
void * pCell;
|
||||
|
||||
ret = tdbBtCursorMoveToRoot(pCur);
|
||||
if (ret < 0) {
|
||||
return -1;
|
||||
}
|
||||
// ret = tdbBtCursorMoveToRoot(pCur);
|
||||
// if (ret < 0) {
|
||||
// return -1;
|
||||
// }
|
||||
|
||||
// if (pCur->pPage->pHdr->nCells == 0) {
|
||||
// // Tree is empty
|
||||
|
@ -220,11 +216,10 @@ static int tdbEncodeLength(u8 *pBuf, uint32_t len) {
|
|||
}
|
||||
|
||||
static int tdbBtCursorMoveToRoot(SBtCursor *pCur) {
|
||||
SBTree * pBt;
|
||||
SPager * pPager;
|
||||
SPage * pPage;
|
||||
SBtPage *pBtPage;
|
||||
int ret;
|
||||
SBTree *pBt;
|
||||
SPager *pPager;
|
||||
SPage * pPage;
|
||||
int ret;
|
||||
|
||||
pBt = pCur->pBt;
|
||||
pPager = pBt->pPager;
|
||||
|
|
|
@ -22,16 +22,15 @@ extern "C" {
|
|||
|
||||
typedef struct SBTree SBTree;
|
||||
typedef struct SBtCursor SBtCursor;
|
||||
typedef struct SBtPage SBtPage;
|
||||
|
||||
struct SBtCursor {
|
||||
SBTree * pBt;
|
||||
i8 iPage;
|
||||
SBtPage *pPage;
|
||||
u16 idx;
|
||||
u16 idxStack[BTREE_MAX_DEPTH + 1];
|
||||
SBtPage *pgStack[BTREE_MAX_DEPTH + 1];
|
||||
void * pBuf;
|
||||
SBTree *pBt;
|
||||
i8 iPage;
|
||||
SPage * pPage;
|
||||
u16 idx;
|
||||
u16 idxStack[BTREE_MAX_DEPTH + 1];
|
||||
SPage * pgStack[BTREE_MAX_DEPTH + 1];
|
||||
void * pBuf;
|
||||
};
|
||||
|
||||
int tdbBtreeOpen(int keyLen, int valLen, SPager *pFile, FKeyComparator kcmpr, SBTree **ppBt);
|
||||
|
|
Loading…
Reference in New Issue