From 733001f633b1bed10bd3e8469d5352fdba802bb4 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Sun, 9 May 2021 15:47:07 +0800 Subject: [PATCH] TD-4088 --- src/common/inc/tdataformat.h | 5 +---- src/inc/taosdef.h | 1 - src/inc/ttype.h | 2 ++ src/os/inc/osInc.h | 4 ++-- src/util/src/exception.c | 16 +++++++++++++++- src/util/src/tarray.c | 1 + src/util/src/tbase64.c | 28 ++++++++++++---------------- src/util/src/tbuffer.c | 5 +---- src/util/src/tcompare.c | 16 ++++++++++++++++ src/util/src/tcompression.c | 2 +- src/util/src/tcrc32c.c | 1 + src/util/src/tdes.c | 14 ++++++++++++++ src/util/src/terror.c | 7 ++----- src/util/src/thashutil.c | 19 +++++++++++++------ src/util/src/tidpool.c | 1 - src/util/src/tlist.c | 3 +-- src/util/src/tlockfree.c | 3 +-- src/util/src/tlosertree.c | 2 +- src/util/src/tmd5.c | 4 +--- 19 files changed, 85 insertions(+), 49 deletions(-) diff --git a/src/common/inc/tdataformat.h b/src/common/inc/tdataformat.h index e8c0760997..88d5b85010 100644 --- a/src/common/inc/tdataformat.h +++ b/src/common/inc/tdataformat.h @@ -15,10 +15,7 @@ #ifndef _TD_DATA_FORMAT_H_ #define _TD_DATA_FORMAT_H_ -#include -#include -#include - +#include "os.h" #include "talgo.h" #include "ttype.h" #include "tutil.h" diff --git a/src/inc/taosdef.h b/src/inc/taosdef.h index e9170860a6..e596ee67ec 100644 --- a/src/inc/taosdef.h +++ b/src/inc/taosdef.h @@ -22,7 +22,6 @@ extern "C" { #include #include -#include "osDef.h" #include "taos.h" #define TSDB__packed diff --git a/src/inc/ttype.h b/src/inc/ttype.h index 662a23bfdb..9949f31c59 100644 --- a/src/inc/ttype.h +++ b/src/inc/ttype.h @@ -5,6 +5,8 @@ extern "C" { #endif +#include +#include #include "taosdef.h" // ----------------- For variable data types such as TSDB_DATA_TYPE_BINARY and TSDB_DATA_TYPE_NCHAR diff --git a/src/os/inc/osInc.h b/src/os/inc/osInc.h index 2e639732f8..6a3c754dcc 100644 --- a/src/os/inc/osInc.h +++ b/src/os/inc/osInc.h @@ -13,8 +13,8 @@ * along with this program. If not, see . */ -#ifndef TDENGINE_OS_LINUX64_H -#define TDENGINE_OS_LINUX64_H +#ifndef TDENGINE_OS_INC_H +#define TDENGINE_OS_INC_H #ifdef __cplusplus extern "C" { diff --git a/src/util/src/exception.c b/src/util/src/exception.c index 0b716b6aba..9740b9031b 100644 --- a/src/util/src/exception.c +++ b/src/util/src/exception.c @@ -1,7 +1,21 @@ +/* + * Copyright (c) 2019 TAOS Data, Inc. + * + * This program is free software: you can use, redistribute, and/or modify + * it under the terms of the GNU Affero General Public License, version 3 + * or later ("AGPL"), as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + #include "os.h" #include "exception.h" - static threadlocal SExceptionNode* expList; void exceptionPushNode( SExceptionNode* node ) { diff --git a/src/util/src/tarray.c b/src/util/src/tarray.c index 4dde5dbba2..f4587b33e7 100644 --- a/src/util/src/tarray.c +++ b/src/util/src/tarray.c @@ -13,6 +13,7 @@ * along with this program. If not, see . */ +#include "os.h" #include "tarray.h" void* taosArrayInit(size_t size, size_t elemSize) { diff --git a/src/util/src/tbase64.c b/src/util/src/tbase64.c index 937adfde5c..1b1f53df17 100644 --- a/src/util/src/tbase64.c +++ b/src/util/src/tbase64.c @@ -1,23 +1,19 @@ -/** - * Copyright (c) 2006-2008 Apple Inc. All rights reserved. +/* + * Copyright (c) 2019 TAOS Data, Inc. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software: you can use, redistribute, and/or modify + * it under the terms of the GNU Affero General Public License, version 3 + * or later ("AGPL"), as published by the Free Software Foundation. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - **/ + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ -#include -#include -#include -#include +#include "os.h" // deprecated this file for bug prone // base64 encode diff --git a/src/util/src/tbuffer.c b/src/util/src/tbuffer.c index a2cb32c1f4..abfa35f42c 100644 --- a/src/util/src/tbuffer.c +++ b/src/util/src/tbuffer.c @@ -14,12 +14,9 @@ */ #include "os.h" -#include -#include -#include #include "tbuffer.h" #include "exception.h" -#include +#include "taoserror.h" //////////////////////////////////////////////////////////////////////////////// // reader functions diff --git a/src/util/src/tcompare.c b/src/util/src/tcompare.c index 354e7899c2..09199eaee3 100644 --- a/src/util/src/tcompare.c +++ b/src/util/src/tcompare.c @@ -1,3 +1,19 @@ +/* + * Copyright (c) 2019 TAOS Data, Inc. + * + * This program is free software: you can use, redistribute, and/or modify + * it under the terms of the GNU Affero General Public License, version 3 + * or later ("AGPL"), as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +#include "os.h" #include "ttype.h" #include "tcompare.h" #include "tarray.h" diff --git a/src/util/src/tcompression.c b/src/util/src/tcompression.c index 1a5d28625f..1de6e76f71 100644 --- a/src/util/src/tcompression.c +++ b/src/util/src/tcompression.c @@ -47,8 +47,8 @@ * */ -#include "lz4.h" #include "os.h" +#include "lz4.h" #include "taosdef.h" #include "tscompression.h" #include "tulog.h" diff --git a/src/util/src/tcrc32c.c b/src/util/src/tcrc32c.c index 054b8f8171..4009973a9f 100644 --- a/src/util/src/tcrc32c.c +++ b/src/util/src/tcrc32c.c @@ -17,6 +17,7 @@ misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ + #ifndef _TD_ARM_ #include #endif diff --git a/src/util/src/tdes.c b/src/util/src/tdes.c index 871ae15a8a..6e003756a3 100644 --- a/src/util/src/tdes.c +++ b/src/util/src/tdes.c @@ -1,3 +1,17 @@ +/* + * Copyright (c) 2019 TAOS Data, Inc. + * + * This program is free software: you can use, redistribute, and/or modify + * it under the terms of the GNU Affero General Public License, version 3 + * or later ("AGPL"), as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ #include "os.h" #include "tkey.h" diff --git a/src/util/src/terror.c b/src/util/src/terror.c index 586a886f47..bc5c513137 100644 --- a/src/util/src/terror.c +++ b/src/util/src/terror.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020 TAOS Data, Inc. + * Copyright (c) 2019 TAOS Data, Inc. * * This program is free software: you can use, redistribute, and/or modify * it under the terms of the GNU Affero General Public License, version 3 @@ -13,10 +13,7 @@ * along with this program. If not, see . */ -#include -#include -#include -#include +#include "os.h" #define TAOS_ERROR_C diff --git a/src/util/src/thashutil.c b/src/util/src/thashutil.c index 681d73db3d..3634dca4c0 100644 --- a/src/util/src/thashutil.c +++ b/src/util/src/thashutil.c @@ -1,12 +1,19 @@ -/** - * MurmurHash3 by Austin Appleby - * @ref - * https://github.com/aappleby/smhasher/blob/master/src/MurmurHash3.cpp +/* + * Copyright (c) 2019 TAOS Data, Inc. * - * Plese refers to the link above for the complete implementation of - * MurmurHash algorithm + * This program is free software: you can use, redistribute, and/or modify + * it under the terms of the GNU Affero General Public License, version 3 + * or later ("AGPL"), as published by the Free Software Foundation. * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . */ + +#include "os.h" #include "hashfunc.h" #include "tutil.h" diff --git a/src/util/src/tidpool.c b/src/util/src/tidpool.c index bd3f774543..61cecf54c0 100644 --- a/src/util/src/tidpool.c +++ b/src/util/src/tidpool.c @@ -15,7 +15,6 @@ #include "os.h" #include "tulog.h" -#include typedef struct { int maxId; diff --git a/src/util/src/tlist.c b/src/util/src/tlist.c index 2f52551e2a..c5b4dbad10 100644 --- a/src/util/src/tlist.c +++ b/src/util/src/tlist.c @@ -12,9 +12,8 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -#include -#include +#include "os.h" #include "tlist.h" SList *tdListNew(int eleSize) { diff --git a/src/util/src/tlockfree.c b/src/util/src/tlockfree.c index 3161518a36..f54206f5cb 100644 --- a/src/util/src/tlockfree.c +++ b/src/util/src/tlockfree.c @@ -12,9 +12,8 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -// #define _GNU_SOURCE -// #include +#include "os.h" #include "tlockfree.h" #define TD_RWLATCH_WRITE_FLAG 0x40000000 diff --git a/src/util/src/tlosertree.c b/src/util/src/tlosertree.c index fa7e4fc340..e793548407 100644 --- a/src/util/src/tlosertree.c +++ b/src/util/src/tlosertree.c @@ -13,8 +13,8 @@ * along with this program. If not, see . */ -#include "tlosertree.h" #include "os.h" +#include "tlosertree.h" #include "taosmsg.h" #include "tulog.h" diff --git a/src/util/src/tmd5.c b/src/util/src/tmd5.c index 4971ed7a12..a1fdcc6a05 100644 --- a/src/util/src/tmd5.c +++ b/src/util/src/tmd5.c @@ -33,10 +33,8 @@ *********************************************************************** */ +#include "os.h" #include "tmd5.h" -#include -#include -#include #include "taosdef.h" /* forward declaration */ -- GitLab