From 78313467e762019d16b52df64e7ba30b83708aa6 Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Mon, 28 Mar 2022 06:17:40 +0000 Subject: [PATCH] refact --- source/libs/tdb/src/db/tdbDb.c | 4 ++-- source/libs/tdb/src/db/tdbEnv.c | 10 +++++----- source/libs/tdb/src/db/tdbTxn.c | 6 +++--- source/libs/tdb/src/inc/tdbDb.h | 2 +- source/libs/tdb/src/inc/tdbEnv.h | 8 ++++---- source/libs/tdb/src/inc/tdbTxn.h | 6 +++--- source/libs/tdb/test/tdbTest.cpp | 2 +- 7 files changed, 19 insertions(+), 19 deletions(-) diff --git a/source/libs/tdb/src/db/tdbDb.c b/source/libs/tdb/src/db/tdbDb.c index 1a66306b15..68adb7ccfc 100644 --- a/source/libs/tdb/src/db/tdbDb.c +++ b/source/libs/tdb/src/db/tdbDb.c @@ -16,7 +16,7 @@ #include "tdbInt.h" struct STDB { - TEnv *pEnv; + TENV *pEnv; SBTree *pBt; }; @@ -24,7 +24,7 @@ struct STDBC { SBTC btc; }; -int tdbDbOpen(const char *fname, int keyLen, int valLen, FKeyComparator keyCmprFn, TEnv *pEnv, TDB **ppDb) { +int tdbDbOpen(const char *fname, int keyLen, int valLen, FKeyComparator keyCmprFn, TENV *pEnv, TDB **ppDb) { TDB *pDb; SPager *pPager; int ret; diff --git a/source/libs/tdb/src/db/tdbEnv.c b/source/libs/tdb/src/db/tdbEnv.c index 1fb2486a2b..4439147e09 100644 --- a/source/libs/tdb/src/db/tdbEnv.c +++ b/source/libs/tdb/src/db/tdbEnv.c @@ -15,8 +15,8 @@ #include "tdbInt.h" -int tdbEnvOpen(const char *rootDir, int pageSize, int cacheSize, TEnv **ppEnv) { - TEnv *pEnv; +int tdbEnvOpen(const char *rootDir, int pageSize, int cacheSize, TENV **ppEnv) { + TENV *pEnv; int dsize; int zsize; u8 *pPtr; @@ -32,7 +32,7 @@ int tdbEnvOpen(const char *rootDir, int pageSize, int cacheSize, TEnv **ppEnv) { return -1; } - pEnv = (TEnv *)pPtr; + pEnv = (TENV *)pPtr; pPtr += sizeof(*pEnv); // pEnv->rootDir pEnv->rootDir = pPtr; @@ -59,12 +59,12 @@ int tdbEnvOpen(const char *rootDir, int pageSize, int cacheSize, TEnv **ppEnv) { return 0; } -int tdbEnvClose(TEnv *pEnv) { +int tdbEnvClose(TENV *pEnv) { // TODO return 0; } -SPager *tdbEnvGetPager(TEnv *pEnv, const char *fname) { +SPager *tdbEnvGetPager(TENV *pEnv, const char *fname) { // TODO return NULL; } \ No newline at end of file diff --git a/source/libs/tdb/src/db/tdbTxn.c b/source/libs/tdb/src/db/tdbTxn.c index 5c7ac0678e..fd4d5de60e 100644 --- a/source/libs/tdb/src/db/tdbTxn.c +++ b/source/libs/tdb/src/db/tdbTxn.c @@ -15,17 +15,17 @@ #include "tdbInt.h" -int tdbTxnBegin(TEnv *pEnv) { +int tdbTxnBegin(TENV *pEnv) { // TODO return 0; } -int tdbTxnCommit(TEnv *pEnv) { +int tdbTxnCommit(TENV *pEnv) { // TODO return 0; } -int tdbTxnRollback(TEnv *pEnv) { +int tdbTxnRollback(TENV *pEnv) { // TODO return 0; } \ No newline at end of file diff --git a/source/libs/tdb/src/inc/tdbDb.h b/source/libs/tdb/src/inc/tdbDb.h index bbeabf4d3e..4fbf65829d 100644 --- a/source/libs/tdb/src/inc/tdbDb.h +++ b/source/libs/tdb/src/inc/tdbDb.h @@ -24,7 +24,7 @@ typedef struct STDB TDB; typedef struct STDBC TDBC; // TDB -int tdbDbOpen(const char *fname, int keyLen, int valLen, FKeyComparator keyCmprFn, TEnv *pEnv, TDB **ppDb); +int tdbDbOpen(const char *fname, int keyLen, int valLen, FKeyComparator keyCmprFn, TENV *pEnv, TDB **ppDb); int tdbDbClose(TDB *pDb); int tdbDbDrop(TDB *pDb); int tdbDbInsert(TDB *pDb, const void *pKey, int keyLen, const void *pVal, int valLen); diff --git a/source/libs/tdb/src/inc/tdbEnv.h b/source/libs/tdb/src/inc/tdbEnv.h index 80ee2e8b07..a651c3a12e 100644 --- a/source/libs/tdb/src/inc/tdbEnv.h +++ b/source/libs/tdb/src/inc/tdbEnv.h @@ -25,12 +25,12 @@ typedef struct STEnv { char *jfname; int jfd; SPCache *pCache; -} TEnv; +} TENV; -int tdbEnvOpen(const char *rootDir, int pageSize, int cacheSize, TEnv **ppEnv); -int tdbEnvClose(TEnv *pEnv); +int tdbEnvOpen(const char *rootDir, int pageSize, int cacheSize, TENV **ppEnv); +int tdbEnvClose(TENV *pEnv); -SPager *tdbEnvGetPager(TEnv *pEnv, const char *fname); +SPager *tdbEnvGetPager(TENV *pEnv, const char *fname); #ifdef __cplusplus } diff --git a/source/libs/tdb/src/inc/tdbTxn.h b/source/libs/tdb/src/inc/tdbTxn.h index 06b31879de..4300dc8324 100644 --- a/source/libs/tdb/src/inc/tdbTxn.h +++ b/source/libs/tdb/src/inc/tdbTxn.h @@ -28,9 +28,9 @@ struct STxn { void *xArg; }; -int tdbTxnBegin(TEnv *pEnv); -int tdbTxnCommit(TEnv *pEnv); -int tdbTxnRollback(TEnv *pEnv); +int tdbTxnBegin(TENV *pEnv); +int tdbTxnCommit(TENV *pEnv); +int tdbTxnRollback(TENV *pEnv); #ifdef __cplusplus } diff --git a/source/libs/tdb/test/tdbTest.cpp b/source/libs/tdb/test/tdbTest.cpp index f4a170f2c0..f41e2bcbee 100644 --- a/source/libs/tdb/test/tdbTest.cpp +++ b/source/libs/tdb/test/tdbTest.cpp @@ -115,7 +115,7 @@ static int tDefaultKeyCmpr(const void *pKey1, int keyLen1, const void *pKey2, in TEST(tdb_test, simple_test) { int ret; - TEnv *pEnv; + TENV *pEnv; TDB *pDb; FKeyComparator compFunc; int nData = 1000000; -- GitLab