diff --git a/include/util/tversion.h b/include/util/tversion.h index 3d7a7e1b66..1774059cf1 100644 --- a/include/util/tversion.h +++ b/include/util/tversion.h @@ -13,8 +13,8 @@ * along with this program. If not, see . */ -#ifndef _TD_UTIL_VERSION_H -#define _TD_UTIL_VERSION_H +#ifndef _TD_UTIL_VERSION_H_ +#define _TD_UTIL_VERSION_H_ #ifdef __cplusplus extern "C" { @@ -28,4 +28,4 @@ int32_t taosCheckVersionCompatible(int32_t clientVer, int32_t serverVer, int32_t } #endif -#endif /*_TD_UTIL_VERSION_H*/ +#endif /*_TD_UTIL_VERSION_H_*/ diff --git a/include/util/tworker.h b/include/util/tworker.h index 771c7c9433..f9d1ce2337 100644 --- a/include/util/tworker.h +++ b/include/util/tworker.h @@ -13,8 +13,8 @@ * along with this program. If not, see . */ -#ifndef _TD_UTIL_WORKER_H -#define _TD_UTIL_WORKER_H +#ifndef _TD_UTIL_WORKER_H_ +#define _TD_UTIL_WORKER_H_ #include "tqueue.h" #ifdef __cplusplus @@ -34,25 +34,25 @@ typedef struct SQWorkerPool { int32_t max; // max number of workers int32_t min; // min number of workers int32_t num; // current number of workers - STaosQset * qset; - const char * name; - SQWorker * workers; + STaosQset *qset; + const char *name; + SQWorker *workers; pthread_mutex_t mutex; } SQWorkerPool, SFWorkerPool; typedef struct SWWorker { int32_t id; // worker id pthread_t thread; // thread - STaosQall * qall; - STaosQset * qset; // queue set + STaosQall *qall; + STaosQset *qset; // queue set SWWorkerPool *pool; } SWWorker; typedef struct SWWorkerPool { int32_t max; // max number of workers int32_t nextId; // from 0 to max-1, cyclic - const char * name; - SWWorker * workers; + const char *name; + SWWorker *workers; pthread_mutex_t mutex; } SWWorkerPool; @@ -75,4 +75,4 @@ void tWWorkerFreeQueue(SWWorkerPool *pool, STaosQueue *queue); } #endif -#endif /*_TD_UTIL_WORKER_H*/ +#endif /*_TD_UTIL_WORKER_H_*/ diff --git a/include/util/types.h b/include/util/types.h index 2e704bb256..f7a535c965 100644 --- a/include/util/types.h +++ b/include/util/types.h @@ -22,14 +22,14 @@ extern "C" { #endif -#define GET_INT8_VAL(x) (*(int8_t *)(x)) -#define GET_INT16_VAL(x) (*(int16_t *)(x)) -#define GET_INT32_VAL(x) (*(int32_t *)(x)) -#define GET_INT64_VAL(x) (*(int64_t *)(x)) -#define GET_UINT8_VAL(x) (*(uint8_t*) (x)) -#define GET_UINT16_VAL(x) (*(uint16_t *)(x)) -#define GET_UINT32_VAL(x) (*(uint32_t *)(x)) -#define GET_UINT64_VAL(x) (*(uint64_t *)(x)) +#define GET_INT8_VAL(x) (*(int8_t *)(x)) +#define GET_INT16_VAL(x) (*(int16_t *)(x)) +#define GET_INT32_VAL(x) (*(int32_t *)(x)) +#define GET_INT64_VAL(x) (*(int64_t *)(x)) +#define GET_UINT8_VAL(x) (*(uint8_t *)(x)) +#define GET_UINT16_VAL(x) (*(uint16_t *)(x)) +#define GET_UINT32_VAL(x) (*(uint32_t *)(x)) +#define GET_UINT64_VAL(x) (*(uint64_t *)(x)) static FORCE_INLINE float taos_align_get_float(const char *pBuf) { #if __STDC_VERSION__ >= 201112L @@ -64,17 +64,22 @@ static FORCE_INLINE double taos_align_get_double(const char *pBuf) { // #define SET_FLOAT_PTR(x, y) { (*(int32_t*) x = *(int32_t*)y); } // #define SET_DOUBLE_PTR(x, y) { (*(int64_t*) x = *(int64_t*)y); } // #else - #define GET_FLOAT_VAL(x) (*(float *)(x)) - #define GET_DOUBLE_VAL(x) (*(double *)(x)) - #define SET_BIGINT_VAL(x, y) { (*(int64_t *)(x)) = (int64_t)(y); } - #define SET_FLOAT_VAL(x, y) { (*(float *)(x)) = (float)(y); } - #define SET_DOUBLE_VAL(x, y) { (*(double *)(x)) = (double)(y); } - #define SET_FLOAT_PTR(x, y) { (*(float *)(x)) = (*(float *)(y)); } - #define SET_DOUBLE_PTR(x, y) { (*(double *)(x)) = (*(double *)(y)); } +#define GET_FLOAT_VAL(x) (*(float *)(x)) +#define GET_DOUBLE_VAL(x) (*(double *)(x)) +#define SET_BIGINT_VAL(x, y) \ + { (*(int64_t *)(x)) = (int64_t)(y); } +#define SET_FLOAT_VAL(x, y) \ + { (*(float *)(x)) = (float)(y); } +#define SET_DOUBLE_VAL(x, y) \ + { (*(double *)(x)) = (double)(y); } +#define SET_FLOAT_PTR(x, y) \ + { (*(float *)(x)) = (*(float *)(y)); } +#define SET_DOUBLE_PTR(x, y) \ + { (*(double *)(x)) = (*(double *)(y)); } // #endif -typedef uint16_t VarDataLenT; // maxVarDataLen: 32767 -#define VARSTR_HEADER_SIZE sizeof(VarDataLenT) +typedef uint16_t VarDataLenT; // maxVarDataLen: 32767 +#define VARSTR_HEADER_SIZE sizeof(VarDataLenT) #define varDataLen(v) ((VarDataLenT *)(v))[0] #define varDataVal(v) ((void *)((char *)v + VARSTR_HEADER_SIZE)) diff --git a/include/util/version.h b/include/util/version.h index 01efecc59d..b241dd248b 100644 --- a/include/util/version.h +++ b/include/util/version.h @@ -13,8 +13,8 @@ * along with this program. If not, see . */ -#ifndef _TD_UTIL_VERSION_H -#define _TD_UTIL_VERSION_H +#ifndef _TD_UTIL_VERSION_H_ +#define _TD_UTIL_VERSION_H_ #ifdef __cplusplus extern "C" { @@ -30,4 +30,4 @@ extern char buildinfo[]; } #endif -#endif /*_TD_UTIL_VERSION_H*/ +#endif /*_TD_UTIL_VERSION_H_*/ diff --git a/source/util/src/tworker.c b/source/util/src/tworker.c index 2843f4e801..1657a85ee8 100644 --- a/source/util/src/tworker.c +++ b/source/util/src/tworker.c @@ -71,8 +71,8 @@ static void *tQWorkerThreadFp(SQWorker *worker) { SQWorkerPool *pool = worker->pool; FItem fp = NULL; - void * msg = NULL; - void * ahandle = NULL; + void *msg = NULL; + void *ahandle = NULL; int32_t code = 0; taosBlockSIGPIPE(); @@ -151,8 +151,8 @@ static void *tFWorkerThreadFp(SQWorker *worker) { SQWorkerPool *pool = worker->pool; FItem fp = NULL; - void * msg = NULL; - void * ahandle = NULL; + void *msg = NULL; + void *ahandle = NULL; int32_t code = 0; taosBlockSIGPIPE(); @@ -240,8 +240,8 @@ static void *tWWorkerThreadFp(SWWorker *worker) { SWWorkerPool *pool = worker->pool; FItems fp = NULL; - void * msg = NULL; - void * ahandle = NULL; + void *msg = NULL; + void *ahandle = NULL; int32_t numOfMsgs = 0; int32_t qtype = 0;