refact: format header file

This commit is contained in:
Hongze Cheng 2022-10-13 11:09:43 +08:00
parent b3b0e5a59a
commit 4cc94968ee
52 changed files with 846 additions and 813 deletions

View File

@ -47,7 +47,8 @@ typedef enum {
int32_t grantCheck(EGrantType grant); int32_t grantCheck(EGrantType grant);
#ifndef GRANTS_CFG #ifndef GRANTS_CFG
#define GRANTS_SCHEMA static const SSysDbTableSchema grantsSchema[] = { \ #define GRANTS_SCHEMA \
static const SSysDbTableSchema grantsSchema[] = { \
{.name = "version", .bytes = 9 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \ {.name = "version", .bytes = 9 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \
{.name = "expire_time", .bytes = 19 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \ {.name = "expire_time", .bytes = 19 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \
{.name = "expired", .bytes = 5 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \ {.name = "expired", .bytes = 5 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \

View File

@ -20,6 +20,8 @@
extern "C" { extern "C" {
#endif #endif
// clang-format off
// sql type // sql type
#ifdef TSDB_SQL_C #ifdef TSDB_SQL_C
@ -103,6 +105,8 @@ enum {
TSDB_DEFINE_SQL_TYPE( TSDB_SQL_MAX, "max" ) TSDB_DEFINE_SQL_TYPE( TSDB_SQL_MAX, "max" )
}; };
// clang-format on
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View File

@ -182,7 +182,8 @@ int32_t catalogRemoveStbMeta(SCatalog* pCtg, const char* dbFName, uint64_t dbId,
* @param pTableMeta(output, table meta data, NEED to free it by calller) * @param pTableMeta(output, table meta data, NEED to free it by calller)
* @return error code * @return error code
*/ */
int32_t catalogGetTableMeta(SCatalog* pCatalog, SRequestConnInfo* pConn, const SName* pTableName, STableMeta** pTableMeta); int32_t catalogGetTableMeta(SCatalog* pCatalog, SRequestConnInfo* pConn, const SName* pTableName,
STableMeta** pTableMeta);
/** /**
* Get a super table's meta data. * Get a super table's meta data.
@ -193,7 +194,8 @@ int32_t catalogGetTableMeta(SCatalog* pCatalog, SRequestConnInfo* pConn, const S
* @param pTableMeta(output, table meta data, NEED to free it by calller) * @param pTableMeta(output, table meta data, NEED to free it by calller)
* @return error code * @return error code
*/ */
int32_t catalogGetSTableMeta(SCatalog* pCatalog, SRequestConnInfo* pConn, const SName* pTableName, STableMeta** pTableMeta); int32_t catalogGetSTableMeta(SCatalog* pCatalog, SRequestConnInfo* pConn, const SName* pTableName,
STableMeta** pTableMeta);
int32_t catalogUpdateTableMeta(SCatalog* pCatalog, STableMetaRsp* rspMsg); int32_t catalogUpdateTableMeta(SCatalog* pCatalog, STableMetaRsp* rspMsg);
@ -232,7 +234,8 @@ int32_t catalogRefreshTableMeta(SCatalog* pCatalog, SRequestConnInfo* pConn, con
* @param isSTable (input, is super table or not, 1:supposed to be stable, 0: supposed not to be stable, -1:not sure) * @param isSTable (input, is super table or not, 1:supposed to be stable, 0: supposed not to be stable, -1:not sure)
* @return error code * @return error code
*/ */
int32_t catalogRefreshGetTableMeta(SCatalog* pCatalog, SRequestConnInfo* pConn, const SName* pTableName, STableMeta** pTableMeta, int32_t isSTable); int32_t catalogRefreshGetTableMeta(SCatalog* pCatalog, SRequestConnInfo* pConn, const SName* pTableName,
STableMeta** pTableMeta, int32_t isSTable);
/** /**
* Get a table's actual vgroup, for stable it's all possible vgroup list. * Get a table's actual vgroup, for stable it's all possible vgroup list.
@ -243,7 +246,8 @@ int32_t catalogRefreshGetTableMeta(SCatalog* pCatalog, SRequestConnInfo* pConn,
* @param pVgroupList (output, vgroup info list, element is SVgroupInfo, NEED to simply free the array by caller) * @param pVgroupList (output, vgroup info list, element is SVgroupInfo, NEED to simply free the array by caller)
* @return error code * @return error code
*/ */
int32_t catalogGetTableDistVgInfo(SCatalog* pCatalog, SRequestConnInfo* pConn, const SName* pTableName, SArray** pVgroupList); int32_t catalogGetTableDistVgInfo(SCatalog* pCatalog, SRequestConnInfo* pConn, const SName* pTableName,
SArray** pVgroupList);
/** /**
* Get a table's vgroup from its name's hash value. * Get a table's vgroup from its name's hash value.
@ -267,7 +271,8 @@ int32_t catalogGetTableHashVgroup(SCatalog* pCatalog, SRequestConnInfo* pConn, c
*/ */
int32_t catalogGetAllMeta(SCatalog* pCatalog, SRequestConnInfo* pConn, const SCatalogReq* pReq, SMetaData* pRsp); int32_t catalogGetAllMeta(SCatalog* pCatalog, SRequestConnInfo* pConn, const SCatalogReq* pReq, SMetaData* pRsp);
int32_t catalogAsyncGetAllMeta(SCatalog* pCtg, SRequestConnInfo* pConn, const SCatalogReq* pReq, catalogCallback fp, void* param, int64_t* jobId); int32_t catalogAsyncGetAllMeta(SCatalog* pCtg, SRequestConnInfo* pConn, const SCatalogReq* pReq, catalogCallback fp,
void* param, int64_t* jobId);
int32_t catalogGetQnodeList(SCatalog* pCatalog, SRequestConnInfo* pConn, SArray* pQnodeList); int32_t catalogGetQnodeList(SCatalog* pCatalog, SRequestConnInfo* pConn, SArray* pQnodeList);
@ -291,7 +296,8 @@ int32_t catalogUpdateTableIndex(SCatalog* pCtg, STableIndexRsp *pRsp);
int32_t catalogGetUdfInfo(SCatalog* pCtg, SRequestConnInfo* pConn, const char* funcName, SFuncInfo* pInfo); int32_t catalogGetUdfInfo(SCatalog* pCtg, SRequestConnInfo* pConn, const char* funcName, SFuncInfo* pInfo);
int32_t catalogChkAuth(SCatalog* pCtg, SRequestConnInfo* pConn, const char* user, const char* dbFName, AUTH_TYPE type, bool *pass); int32_t catalogChkAuth(SCatalog* pCtg, SRequestConnInfo* pConn, const char* user, const char* dbFName, AUTH_TYPE type,
bool* pass);
int32_t catalogUpdateUserAuthInfo(SCatalog* pCtg, SGetUserAuthRsp* pAuth); int32_t catalogUpdateUserAuthInfo(SCatalog* pCtg, SGetUserAuthRsp* pAuth);

View File

@ -20,10 +20,10 @@
extern "C" { extern "C" {
#endif #endif
#include "os.h"
#include "thash.h"
#include "executor.h" #include "executor.h"
#include "os.h"
#include "plannodes.h" #include "plannodes.h"
#include "thash.h"
#define DS_BUF_LOW 1 #define DS_BUF_LOW 1
#define DS_BUF_FULL 2 #define DS_BUF_FULL 2

View File

@ -16,8 +16,8 @@
#ifndef TDENGINE_TAOSUDF_H #ifndef TDENGINE_TAOSUDF_H
#define TDENGINE_TAOSUDF_H #define TDENGINE_TAOSUDF_H
#include <stdint.h>
#include <stdbool.h> #include <stdbool.h>
#include <stdint.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
@ -61,7 +61,6 @@ typedef struct SUdfColumnData {
}; };
} SUdfColumnData; } SUdfColumnData;
typedef struct SUdfColumn { typedef struct SUdfColumn {
SUdfColumnMeta colMeta; SUdfColumnMeta colMeta;
bool hasNull; bool hasNull;
@ -92,7 +91,8 @@ typedef int32_t (*TUdfDestroyFunc)();
#define BitmapLen(_n) (((_n) + ((1 << NBIT) - 1)) >> NBIT) #define BitmapLen(_n) (((_n) + ((1 << NBIT) - 1)) >> NBIT)
#define udfColDataIsNull_var(pColumn, row) ((pColumn->colData.varLenCol.varOffsets)[row] == -1) #define udfColDataIsNull_var(pColumn, row) ((pColumn->colData.varLenCol.varOffsets)[row] == -1)
#define udfColDataIsNull_f(pColumn, row) ((BMCharPos(pColumn->colData.fixLenCol.nullBitmap, row) & (1u << (7u - BitPos(row)))) == (1u << (7u - BitPos(row)))) #define udfColDataIsNull_f(pColumn, row) \
((BMCharPos(pColumn->colData.fixLenCol.nullBitmap, row) & (1u << (7u - BitPos(row)))) == (1u << (7u - BitPos(row))))
#define udfColDataSetNull_f(pColumn, row) \ #define udfColDataSetNull_f(pColumn, row) \
do { \ do { \
BMCharPos(pColumn->colData.fixLenCol.nullBitmap, row) |= (1u << (7u - BitPos(row))); \ BMCharPos(pColumn->colData.fixLenCol.nullBitmap, row) |= (1u << (7u - BitPos(row))); \
@ -116,7 +116,6 @@ typedef uint16_t VarDataLenT; // maxVarDataLen: 32767
(((t) == TSDB_DATA_TYPE_VARCHAR) || ((t) == TSDB_DATA_TYPE_NCHAR) || ((t) == TSDB_DATA_TYPE_JSON)) (((t) == TSDB_DATA_TYPE_VARCHAR) || ((t) == TSDB_DATA_TYPE_NCHAR) || ((t) == TSDB_DATA_TYPE_JSON))
#define IS_STR_DATA_TYPE(t) (((t) == TSDB_DATA_TYPE_VARCHAR) || ((t) == TSDB_DATA_TYPE_NCHAR)) #define IS_STR_DATA_TYPE(t) (((t) == TSDB_DATA_TYPE_VARCHAR) || ((t) == TSDB_DATA_TYPE_NCHAR))
static FORCE_INLINE char *udfColDataGetData(const SUdfColumn *pColumn, int32_t row) { static FORCE_INLINE char *udfColDataGetData(const SUdfColumn *pColumn, int32_t row) {
if (IS_VAR_DATA_TYPE(pColumn->colMeta.type)) { if (IS_VAR_DATA_TYPE(pColumn->colMeta.type)) {
return pColumn->colData.varLenCol.payload + pColumn->colData.varLenCol.varOffsets[row]; return pColumn->colData.varLenCol.payload + pColumn->colData.varLenCol.varOffsets[row];

View File

@ -24,12 +24,12 @@
#define alloc alloc #define alloc alloc
#include <taosudf.h> #include <taosudf.h>
#include <stdint.h>
#include <stdbool.h> #include <stdbool.h>
#include "tmsg.h" #include <stdint.h>
#include "tcommon.h"
#include "function.h" #include "function.h"
#include "tcommon.h"
#include "tdatablock.h" #include "tdatablock.h"
#include "tmsg.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
@ -43,7 +43,6 @@ extern "C" {
#endif #endif
#define UDF_DNODE_ID_ENV_NAME "DNODE_ID" #define UDF_DNODE_ID_ENV_NAME "DNODE_ID"
// low level APIs // low level APIs
/** /**
* setup udf * setup udf
@ -62,7 +61,8 @@ int32_t doCallUdfAggProcess(UdfcFuncHandle handle, SSDataBlock *block, SUdfInter
int32_t doCallUdfAggFinalize(UdfcFuncHandle handle, SUdfInterBuf *interBuf, SUdfInterBuf *resultData); int32_t doCallUdfAggFinalize(UdfcFuncHandle handle, SUdfInterBuf *interBuf, SUdfInterBuf *resultData);
// input: interbuf1, interbuf2 // input: interbuf1, interbuf2
// output: resultBuf // output: resultBuf
int32_t doCallUdfAggMerge(UdfcFuncHandle handle, SUdfInterBuf *interBuf1, SUdfInterBuf *interBuf2, SUdfInterBuf *resultBuf); int32_t doCallUdfAggMerge(UdfcFuncHandle handle, SUdfInterBuf *interBuf1, SUdfInterBuf *interBuf2,
SUdfInterBuf *resultBuf);
// input: block // input: block
// output: resultData // output: resultData
int32_t doCallUdfScalarFunc(UdfcFuncHandle handle, SScalarParam *input, int32_t numOfCols, SScalarParam *output); int32_t doCallUdfScalarFunc(UdfcFuncHandle handle, SScalarParam *input, int32_t numOfCols, SScalarParam *output);

View File

@ -227,7 +227,6 @@ int32_t tDeserializeSMonMloadInfo(void *buf, int32_t bufLen, SMonMloadInfo *pInf
int32_t tSerializeSQnodeLoad(void *buf, int32_t bufLen, SQnodeLoad *pInfo); int32_t tSerializeSQnodeLoad(void *buf, int32_t bufLen, SQnodeLoad *pInfo);
int32_t tDeserializeSQnodeLoad(void *buf, int32_t bufLen, SQnodeLoad *pInfo); int32_t tDeserializeSQnodeLoad(void *buf, int32_t bufLen, SQnodeLoad *pInfo);
typedef struct { typedef struct {
const char *server; const char *server;
uint16_t port; uint16_t port;

View File

@ -61,7 +61,6 @@ typedef struct STableComInfo {
int32_t rowSize; // row size of the schema int32_t rowSize; // row size of the schema
} STableComInfo; } STableComInfo;
typedef struct SIndexMeta { typedef struct SIndexMeta {
#if defined(WINDOWS) || defined(_TD_DARWIN_64) #if defined(WINDOWS) || defined(_TD_DARWIN_64)
size_t avoidCompilationErrors; size_t avoidCompilationErrors;
@ -265,7 +264,9 @@ extern int32_t (*queryProcessMsgRsp[TDMT_MAX])(void* output, char* msg, int32_t
#define REQUEST_TOTAL_EXEC_TIMES 2 #define REQUEST_TOTAL_EXEC_TIMES 2
#define IS_SYS_DBNAME(_dbname) (((*(_dbname) == 'i') && (0 == strcmp(_dbname, TSDB_INFORMATION_SCHEMA_DB))) || ((*(_dbname) == 'p') && (0 == strcmp(_dbname, TSDB_PERFORMANCE_SCHEMA_DB)))) #define IS_SYS_DBNAME(_dbname) \
(((*(_dbname) == 'i') && (0 == strcmp(_dbname, TSDB_INFORMATION_SCHEMA_DB))) || \
((*(_dbname) == 'p') && (0 == strcmp(_dbname, TSDB_PERFORMANCE_SCHEMA_DB))))
#define qFatal(...) \ #define qFatal(...) \
do { \ do { \

View File

@ -72,7 +72,6 @@ typedef struct SQWMsg {
SRpcHandleInfo connInfo; SRpcHandleInfo connInfo;
} SQWMsg; } SQWMsg;
int32_t qWorkerInit(int8_t nodeType, int32_t nodeId, void **qWorkerMgmt, const SMsgCb *pMsgCb); int32_t qWorkerInit(int8_t nodeType, int32_t nodeId, void **qWorkerMgmt, const SMsgCb *pMsgCb);
int32_t qWorkerAbortPreprocessQueryMsg(void *qWorkerMgmt, SRpcMsg *pMsg); int32_t qWorkerAbortPreprocessQueryMsg(void *qWorkerMgmt, SRpcMsg *pMsg);
@ -99,9 +98,11 @@ void qWorkerDestroy(void **qWorkerMgmt);
int32_t qWorkerGetStat(SReadHandle *handle, void *qWorkerMgmt, SQWorkerStat *pStat); int32_t qWorkerGetStat(SReadHandle *handle, void *qWorkerMgmt, SQWorkerStat *pStat);
int32_t qWorkerProcessLocalQuery(void *pMgmt, uint64_t sId, uint64_t qId, uint64_t tId, int64_t rId, int32_t eId, SQWMsg *qwMsg, SArray *explainRes); int32_t qWorkerProcessLocalQuery(void *pMgmt, uint64_t sId, uint64_t qId, uint64_t tId, int64_t rId, int32_t eId,
SQWMsg *qwMsg, SArray *explainRes);
int32_t qWorkerProcessLocalFetch(void *pMgmt, uint64_t sId, uint64_t qId, uint64_t tId, int64_t rId, int32_t eId, void** pRsp, SArray* explainRes); int32_t qWorkerProcessLocalFetch(void *pMgmt, uint64_t sId, uint64_t qId, uint64_t tId, int64_t rId, int32_t eId,
void **pRsp, SArray *explainRes);
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -41,7 +41,8 @@ typedef struct SFilterColumnParam {
} SFilterColumnParam; } SFilterColumnParam;
extern int32_t filterInitFromNode(SNode *pNode, SFilterInfo **pinfo, uint32_t options); extern int32_t filterInitFromNode(SNode *pNode, SFilterInfo **pinfo, uint32_t options);
extern bool filterExecute(SFilterInfo *info, SSDataBlock *pSrc, SColumnInfoData** p, SColumnDataAgg *statis, int16_t numOfCols, int32_t* pFilterResStatus); extern bool filterExecute(SFilterInfo *info, SSDataBlock *pSrc, SColumnInfoData **p, SColumnDataAgg *statis,
int16_t numOfCols, int32_t *pFilterResStatus);
extern int32_t filterSetDataFromSlotId(SFilterInfo *info, void *param); extern int32_t filterSetDataFromSlotId(SFilterInfo *info, void *param);
extern int32_t filterSetDataFromColId(SFilterInfo *info, void *param); extern int32_t filterSetDataFromColId(SFilterInfo *info, void *param);
extern int32_t filterGetTimeRange(SNode *pNode, STimeWindow *win, bool *isStrict); extern int32_t filterGetTimeRange(SNode *pNode, STimeWindow *win, bool *isStrict);

View File

@ -80,7 +80,6 @@ typedef struct SSchedulerReq {
void** pFetchRes; void** pFetchRes;
} SSchedulerReq; } SSchedulerReq;
int32_t schedulerInit(void); int32_t schedulerInit(void);
int32_t schedulerExecJob(SSchedulerReq* pReq, int64_t* pJob); int32_t schedulerExecJob(SSchedulerReq* pReq, int64_t* pJob);

View File

@ -16,8 +16,8 @@
#ifndef _TD_TFS_H_ #ifndef _TD_TFS_H_
#define _TD_TFS_H_ #define _TD_TFS_H_
#include "tdef.h"
#include "monitor.h" #include "monitor.h"
#include "tdef.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {

View File

@ -26,28 +26,28 @@ extern "C" {
#include <regex.h> #include <regex.h>
#if !defined(WINDOWS) #if !defined(WINDOWS)
#include <unistd.h>
#include <dirent.h> #include <dirent.h>
#include <sched.h>
#include <wordexp.h>
#include <libgen.h> #include <libgen.h>
#include <sched.h>
#include <unistd.h>
#include <wordexp.h>
#include <sys/utsname.h>
#include <sys/param.h>
#include <sys/mman.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include <sys/mman.h>
#include <sys/param.h>
#include <sys/shm.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/statvfs.h>
#include <sys/time.h> #include <sys/time.h>
#include <sys/types.h> #include <sys/types.h>
#include <termios.h> #include <sys/utsname.h>
#include <sys/statvfs.h>
#include <sys/shm.h>
#include <sys/wait.h> #include <sys/wait.h>
#include <termios.h>
#if defined(DARWIN) #if defined(DARWIN)
#else #else
#include <sys/prctl.h>
#include <argp.h> #include <argp.h>
#include <sys/prctl.h>
#endif #endif
#else #else
@ -82,11 +82,13 @@ extern "C" {
#include <wchar.h> #include <wchar.h>
#include <wctype.h> #include <wctype.h>
#include "taoserror.h" #include "osThread.h"
#include "osAtomic.h" #include "osAtomic.h"
#include "osDef.h" #include "osDef.h"
#include "osDir.h" #include "osDir.h"
#include "osEndian.h" #include "osEndian.h"
#include "osEnv.h"
#include "osFile.h" #include "osFile.h"
#include "osLocale.h" #include "osLocale.h"
#include "osLz4.h" #include "osLz4.h"
@ -94,10 +96,9 @@ extern "C" {
#include "osMemory.h" #include "osMemory.h"
#include "osProc.h" #include "osProc.h"
#include "osRand.h" #include "osRand.h"
#include "osThread.h"
#include "osSemaphore.h" #include "osSemaphore.h"
#include "osSignal.h"
#include "osShm.h" #include "osShm.h"
#include "osSignal.h"
#include "osSleep.h" #include "osSleep.h"
#include "osSocket.h" #include "osSocket.h"
#include "osString.h" #include "osString.h"
@ -106,7 +107,7 @@ extern "C" {
#include "osTime.h" #include "osTime.h"
#include "osTimer.h" #include "osTimer.h"
#include "osTimezone.h" #include "osTimezone.h"
#include "osEnv.h" #include "taoserror.h"
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -54,7 +54,6 @@ extern "C" {
#endif #endif
#endif #endif
#if defined(WINDOWS) #if defined(WINDOWS)
char *stpcpy(char *dest, const char *src); char *stpcpy(char *dest, const char *src);
char *stpncpy(char *dest, const char *src, int n); char *stpncpy(char *dest, const char *src, int n);
@ -171,9 +170,15 @@ extern "C" {
#define DEFAULT_DOUBLE_COMP(x, y) \ #define DEFAULT_DOUBLE_COMP(x, y) \
do { \ do { \
if (isnan(x) && isnan(y)) { return 0; } \ if (isnan(x) && isnan(y)) { \
if (isnan(x)) { return -1; } \ return 0; \
if (isnan(y)) { return 1; } \ } \
if (isnan(x)) { \
return -1; \
} \
if (isnan(y)) { \
return 1; \
} \
if ((x) == (y)) { \ if ((x) == (y)) { \
return 0; \ return 0; \
} else { \ } else { \
@ -209,14 +214,20 @@ extern "C" {
#if defined(_TD_DARWIN_64) #if defined(_TD_DARWIN_64)
// MacOS // MacOS
#if !defined(_GNU_SOURCE) #if !defined(_GNU_SOURCE)
#define setThreadName(name) do { pthread_setname_np((name)); } while (0) #define setThreadName(name) \
do { \
pthread_setname_np((name)); \
} while (0)
#else #else
// pthread_setname_np not defined // pthread_setname_np not defined
#define setThreadName(name) #define setThreadName(name)
#endif #endif
#else #else
// Linux, length of name must <= 16 (the last '\0' included) // Linux, length of name must <= 16 (the last '\0' included)
#define setThreadName(name) do { prctl(PR_SET_NAME, (name)); } while (0) #define setThreadName(name) \
do { \
prctl(PR_SET_NAME, (name)); \
} while (0)
#endif #endif
#else #else
// Windows // Windows

View File

@ -51,7 +51,6 @@ extern "C" {
typedef struct TdDir *TdDirPtr; typedef struct TdDir *TdDirPtr;
typedef struct TdDirEntry *TdDirEntryPtr; typedef struct TdDirEntry *TdDirEntryPtr;
void taosRemoveDir(const char *dirname); void taosRemoveDir(const char *dirname);
bool taosDirExist(const char *dirname); bool taosDirExist(const char *dirname);
int32_t taosMkDir(const char *dirname); int32_t taosMkDir(const char *dirname);

View File

@ -24,8 +24,7 @@ extern "C" {
#ifdef __APPLE__ #ifdef __APPLE__
enum EPOLL_EVENTS enum EPOLL_EVENTS {
{
EPOLLIN = 0x001, EPOLLIN = 0x001,
#define EPOLLIN EPOLLIN #define EPOLLIN EPOLLIN
EPOLLPRI = 0x002, EPOLLPRI = 0x002,
@ -63,17 +62,14 @@ enum EPOLL_EVENTS
#define EPOLL_CTL_DEL 2 /* Remove a file descriptor from the interface. */ #define EPOLL_CTL_DEL 2 /* Remove a file descriptor from the interface. */
#define EPOLL_CTL_MOD 3 /* Change file descriptor epoll_event structure. */ #define EPOLL_CTL_MOD 3 /* Change file descriptor epoll_event structure. */
typedef union epoll_data {
typedef union epoll_data
{
void *ptr; void *ptr;
int fd; int fd;
uint32_t u32; uint32_t u32;
uint64_t u64; uint64_t u64;
} epoll_data_t; } epoll_data_t;
struct epoll_event struct epoll_event {
{
uint32_t events; /* Epoll events */ uint32_t events; /* Epoll events */
epoll_data_t data; /* User data variable */ epoll_data_t data; /* User data variable */
}; };
@ -90,4 +86,3 @@ int epoll_close(int epfd);
#endif #endif
#endif // _eok_h_fd274616_996c_400e_9023_ae70be881fa3_ #endif // _eok_h_fd274616_996c_400e_9023_ae70be881fa3_

View File

@ -44,7 +44,6 @@ typedef pthread_key_t TdThreadKey;
#define taosThreadCleanupPush pthread_cleanup_push #define taosThreadCleanupPush pthread_cleanup_push
#define taosThreadCleanupPop pthread_cleanup_pop #define taosThreadCleanupPop pthread_cleanup_pop
#ifdef WINDOWS #ifdef WINDOWS
#define TD_PTHREAD_MUTEX_INITIALIZER (TdThreadMutex)(-1) #define TD_PTHREAD_MUTEX_INITIALIZER (TdThreadMutex)(-1)
#else #else

View File

@ -26,8 +26,7 @@ extern "C" {
#define tzset TZSET_FUNC_TAOS_FORBID #define tzset TZSET_FUNC_TAOS_FORBID
#endif #endif
enum TdTimezone enum TdTimezone {
{
TdWestZone12 = -12, TdWestZone12 = -12,
TdWestZone11, TdWestZone11,
TdWestZone10, TdWestZone10,

View File

@ -38,8 +38,7 @@ typedef struct SBloomFilter {
SBloomFilter *tBloomFilterInit(uint64_t expectedEntries, double errorRate); SBloomFilter *tBloomFilterInit(uint64_t expectedEntries, double errorRate);
int32_t tBloomFilterPut(SBloomFilter *pBF, const void *keyBuf, uint32_t len); int32_t tBloomFilterPut(SBloomFilter *pBF, const void *keyBuf, uint32_t len);
int32_t tBloomFilterNoContain(const SBloomFilter *pBF, const void *keyBuf, int32_t tBloomFilterNoContain(const SBloomFilter *pBF, const void *keyBuf, uint32_t len);
uint32_t len);
void tBloomFilterDestroy(SBloomFilter *pBF); void tBloomFilterDestroy(SBloomFilter *pBF);
void tBloomFilterDump(const SBloomFilter *pBF); void tBloomFilterDump(const SBloomFilter *pBF);
bool tBloomFilterIsFull(const SBloomFilter *pBF); bool tBloomFilterIsFull(const SBloomFilter *pBF);

View File

@ -32,7 +32,8 @@
#define COMPRESSION 300 #define COMPRESSION 300
#define GET_CENTROID(compression) (ceil(compression * M_PI / 2) + 1 + ADDITION_CENTROID_NUM) #define GET_CENTROID(compression) (ceil(compression * M_PI / 2) + 1 + ADDITION_CENTROID_NUM)
#define GET_THRESHOLD(compression) (7.5 + 0.37 * compression - 2e-4 * pow(compression, 2)) #define GET_THRESHOLD(compression) (7.5 + 0.37 * compression - 2e-4 * pow(compression, 2))
#define TDIGEST_SIZE(compression) (sizeof(TDigest) + sizeof(SCentroid)*GET_CENTROID(compression) + sizeof(SPt)*GET_THRESHOLD(compression)) #define TDIGEST_SIZE(compression) \
(sizeof(TDigest) + sizeof(SCentroid) * GET_CENTROID(compression) + sizeof(SPt) * GET_THRESHOLD(compression))
typedef struct SCentroid { typedef struct SCentroid {
double mean; double mean;

View File

@ -28,10 +28,7 @@ typedef void (*_taos_lru_deleter_t)(const void *key, size_t keyLen, void *value)
typedef struct LRUHandle LRUHandle; typedef struct LRUHandle LRUHandle;
typedef enum { typedef enum { TAOS_LRU_PRIORITY_HIGH, TAOS_LRU_PRIORITY_LOW } LRUPriority;
TAOS_LRU_PRIORITY_HIGH,
TAOS_LRU_PRIORITY_LOW
} LRUPriority;
typedef enum { typedef enum {
TAOS_LRU_STATUS_OK, TAOS_LRU_STATUS_OK,

View File

@ -53,7 +53,8 @@ typedef struct SDiskbasedBufStatis {
* @param handle * @param handle
* @return * @return
*/ */
int32_t createDiskbasedBuf(SDiskbasedBuf** pBuf, int32_t pagesize, int32_t inMemBufSize, const char* id, const char* dir); int32_t createDiskbasedBuf(SDiskbasedBuf** pBuf, int32_t pagesize, int32_t inMemBufSize, const char* id,
const char* dir);
/** /**
* *

View File

@ -30,8 +30,7 @@ typedef struct SScalableBf {
SScalableBf *tScalableBfInit(uint64_t expectedEntries, double errorRate); SScalableBf *tScalableBfInit(uint64_t expectedEntries, double errorRate);
int32_t tScalableBfPut(SScalableBf *pSBf, const void *keyBuf, uint32_t len); int32_t tScalableBfPut(SScalableBf *pSBf, const void *keyBuf, uint32_t len);
int32_t tScalableBfNoContain(const SScalableBf *pSBf, const void *keyBuf, int32_t tScalableBfNoContain(const SScalableBf *pSBf, const void *keyBuf, uint32_t len);
uint32_t len);
void tScalableBfDestroy(SScalableBf *pSBf); void tScalableBfDestroy(SScalableBf *pSBf);
int32_t tScalableBfEncode(const SScalableBf *pSBf, SEncoder *pEncoder); int32_t tScalableBfEncode(const SScalableBf *pSBf, SEncoder *pEncoder);
SScalableBf *tScalableBfDecode(SDecoder *pDecoder); SScalableBf *tScalableBfDecode(SDecoder *pDecoder);

View File

@ -19,8 +19,8 @@
#include "os.h" #include "os.h"
#include "tcrc32c.h" #include "tcrc32c.h"
#include "tdef.h" #include "tdef.h"
#include "tmd5.h"
#include "thash.h" #include "thash.h"
#include "tmd5.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {

View File

@ -0,0 +1,21 @@
#!/bin/bash
PRJ_ROOT_DIR=$(readlink -f -- "$(dirname $0)/../..")
FORMAT_BIN=clang-format-14
ORIGIN_DIR=$(pwd)
cd ${PRJ_ROOT_DIR}
FORMAT_DIR_LIST=(
"include"
# "source"
)
for d in ${FORMAT_DIR_LIST[@]}; do
for f in $(find ${PRJ_ROOT_DIR}/$d/ -regex '.*\.\(cpp\|hpp\|c\|h\)'); do
${FORMAT_BIN} -i $f
done
done
cd ${ORIGIN_DIR}