From cbd0d74d51f503aebd7f43e9de4905973205a09b Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Wed, 30 Mar 2022 07:22:14 +0000 Subject: [PATCH] refact --- source/libs/tdb/src/db/tdbBtree.c | 15 +++++---------- source/libs/tdb/src/inc/tdbBtree.h | 1 - 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/source/libs/tdb/src/db/tdbBtree.c b/source/libs/tdb/src/db/tdbBtree.c index 6c7f7e2471..6372216dd0 100644 --- a/source/libs/tdb/src/db/tdbBtree.c +++ b/source/libs/tdb/src/db/tdbBtree.c @@ -65,7 +65,7 @@ typedef struct { u8 *pBuf; } SCellDecoder; -static int tdbBtCursorMoveTo(SBTC *pBtc, const void *pKey, int kLen, int *pCRst); +static int tdbBtcMoveTo(SBTC *pBtc, const void *pKey, int kLen, int *pCRst); static int tdbDefaultKeyCmprFn(const void *pKey1, int keyLen1, const void *pKey2, int keyLen2); static int tdbBtreeOpenImpl(SBTree *pBt); static int tdbBtreeZeroPage(SPage *pPage, void *arg); @@ -136,7 +136,7 @@ int tdbBtCursorInsert(SBTC *pBtc, const void *pKey, int kLen, const void *pVal, int cret; SBTree *pBt; - ret = tdbBtCursorMoveTo(pBtc, pKey, kLen, &cret); + ret = tdbBtcMoveTo(pBtc, pKey, kLen, &cret); if (ret < 0) { // TODO: handle error return -1; @@ -199,7 +199,7 @@ int tdbBtreeGet(SBTree *pBt, const void *pKey, int kLen, void **ppVal, int *vLen tdbBtcOpen(&btc, pBt); - tdbBtCursorMoveTo(&btc, pKey, kLen, &cret); + tdbBtcMoveTo(&btc, pKey, kLen, &cret); if (cret) { return cret; @@ -229,7 +229,7 @@ int tdbBtreePGet(SBTree *pBt, const void *pKey, int kLen, void **ppKey, int *pkL tdbBtcOpen(&btc, pBt); - tdbBtCursorMoveTo(&btc, pKey, kLen, &cret); + tdbBtcMoveTo(&btc, pKey, kLen, &cret); if (cret) { return cret; } @@ -988,7 +988,7 @@ int tdbBtcOpen(SBTC *pBtc, SBTree *pBt) { return 0; } -static int tdbBtCursorMoveTo(SBTC *pBtc, const void *pKey, int kLen, int *pCRst) { +static int tdbBtcMoveTo(SBTC *pBtc, const void *pKey, int kLen, int *pCRst) { int ret; SBTree *pBt; SPager *pPager; @@ -1176,11 +1176,6 @@ int tdbBtcMoveToLast(SBTC *pBtc) { return 0; } -int tdbBtcMoveTo(SBTC *pBtc, const void *pKey, int kLen) { - // TODO - return 0; -} - int tdbBtreeNext(SBTC *pBtc, void **ppKey, int *kLen, void **ppVal, int *vLen) { SCell *pCell; SCellDecoder cd; diff --git a/source/libs/tdb/src/inc/tdbBtree.h b/source/libs/tdb/src/inc/tdbBtree.h index a320401a48..2797b5ea5e 100644 --- a/source/libs/tdb/src/inc/tdbBtree.h +++ b/source/libs/tdb/src/inc/tdbBtree.h @@ -48,7 +48,6 @@ int tdbBtreePGet(SBTree *pBt, const void *pKey, int kLen, void **ppKey, int *pkL int tdbBtcOpen(SBTC *pCur, SBTree *pBt); int tdbBtcMoveToFirst(SBTC *pBtc); int tdbBtcMoveToLast(SBTC *pBtc); -int tdbBtcMoveTo(SBTC *pBtc, const void *pKey, int kLen); int tdbBtreeNext(SBTC *pBtc, void **ppKey, int *kLen, void **ppVal, int *vLen); int tdbBtcClose(SBTC *pBtc);