diff --git a/source/libs/tdb/src/db/btree.c b/source/libs/tdb/src/db/btree.c index c38a6db8c27492b0dcd9b99fafe8ebb91e66daed..01db2a84037197b84cc87e4343dc085a5106cf54 100644 --- a/source/libs/tdb/src/db/btree.c +++ b/source/libs/tdb/src/db/btree.c @@ -66,12 +66,21 @@ int btreeClose(SBTree *pBt) { } static int btreeCreate(SBTree **pBt) { + SBTree *pBt; + + pBt = (SBTree *)calloc(1, sizeof(*pBt)); + if (pBt == NULL) { + return -1; + } + // TODO return 0; } static int btreeDestroy(SBTree *pBt) { - // TODO + if (pBt) { + free(pBt); + } return 0; } diff --git a/source/libs/tdb/src/inc/btree.h b/source/libs/tdb/src/inc/btree.h index f12184b3eb5f51f504d2b3d5419800a62d12e3c3..94af3331bae7b5485026ffe5bb88c35ec65f8d5a 100644 --- a/source/libs/tdb/src/inc/btree.h +++ b/source/libs/tdb/src/inc/btree.h @@ -34,7 +34,7 @@ int btreeCursorMoveTo(SBtCursor *pBtCur, int kLen, const void *pKey); int btreeCursorNext(SBtCursor *pBtCur); struct SBTree { - pgno_t root; + pgno_t root; }; #ifdef __cplusplus