提交 f4a863e5 编写于 作者: H Hongze Cheng

refact

上级 d6229165
......@@ -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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册