From 74f73e6bab20c86f2e6dca433eb5951be33895a5 Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Mon, 14 Feb 2022 09:01:33 +0000 Subject: [PATCH] more TDB --- source/libs/tdb/src/db/btree.c | 11 ++++++++++- source/libs/tdb/src/inc/btree.h | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/source/libs/tdb/src/db/btree.c b/source/libs/tdb/src/db/btree.c index c38a6db8c2..01db2a8403 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 f12184b3eb..94af3331ba 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 -- GitLab