This is an automated email from the ASF dual-hosted git repository. panxiaolei pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push: new af410303a36 [Chore](utils) remove some unused code (#40423) af410303a36 is described below commit af410303a367ff5ce6d19958e188adea0dda002d Author: Pxl <pxl...@qq.com> AuthorDate: Fri Sep 6 11:14:50 2024 +0800 [Chore](utils) remove some unused code (#40423) ## Proposed changes remove some unused code --- be/src/olap/utils.cpp | 42 ------------------------------------- be/src/olap/utils.h | 57 --------------------------------------------------- 2 files changed, 99 deletions(-) diff --git a/be/src/olap/utils.cpp b/be/src/olap/utils.cpp index aa641207b23..5ae8b7ab9df 100644 --- a/be/src/olap/utils.cpp +++ b/be/src/olap/utils.cpp @@ -369,35 +369,6 @@ static const unsigned int T8_7[256] = { 0xCF56CE31, 0x14124958, 0x5D2E347F, 0xE54C35A1, 0xAC704886, 0x7734CFEF, 0x3E08B2C8, 0xC451B7CC, 0x8D6DCAEB, 0x56294D82, 0x1F1530A5}; -unsigned int crc32c_lut(char const* b, unsigned int off, unsigned int len, unsigned int crc) { - unsigned int localCrc = crc; - while (len > 7) { - unsigned int c0 = b[off++] ^ localCrc; - unsigned int c1 = b[off++] ^ (localCrc >>= 8); - unsigned int c2 = b[off++] ^ (localCrc >>= 8); - unsigned int c3 = b[off++] ^ (localCrc >>= 8); - - localCrc = (T8_7[c0 & 0xff] ^ T8_6[c1 & 0xff]) ^ (T8_5[c2 & 0xff] ^ T8_4[c3 & 0xff]); - - c0 = b[off++] & 0xff; - c1 = b[off++] & 0xff; - c2 = b[off++] & 0xff; - c3 = b[off++] & 0xff; - - localCrc ^= (T8_3[c0] ^ T8_2[c1]) ^ (T8_1[c2] ^ T8_0[c3]); - - len -= 8; - } - - while (len > 0) { - localCrc = (localCrc >> 8) ^ T8_0[(localCrc ^ b[off++]) & 0xffL]; - len--; - } - - // Publish crc out to object - return localCrc; -} - Status gen_timestamp_string(std::string* out_string) { time_t now = time(nullptr); tm local_tm; @@ -414,10 +385,6 @@ Status gen_timestamp_string(std::string* out_string) { return Status::OK(); } -int operator-(const BinarySearchIterator& left, const BinarySearchIterator& right) { - return *left - *right; -} - Status read_write_test_file(const std::string& test_file_path) { if (access(test_file_path.c_str(), F_OK) == 0) { if (remove(test_file_path.c_str()) != 0) { @@ -656,13 +623,4 @@ bool valid_ipv6(const std::string& value_str) { return IPv6Value::is_valid_string(value_str.c_str(), value_str.size()); } -void write_log_info(char* buf, size_t buf_len, const char* fmt, ...) { - va_list args; - va_start(args, fmt); - - vsnprintf(buf, buf_len, fmt, args); - - va_end(args); -} - } // namespace doris diff --git a/be/src/olap/utils.h b/be/src/olap/utils.h index 6528d2a86a4..8c848639147 100644 --- a/be/src/olap/utils.h +++ b/be/src/olap/utils.h @@ -34,7 +34,6 @@ #include "olap/olap_common.h" namespace doris { -void write_log_info(char* buf, size_t buf_len, const char* fmt, ...); static const std::string DELETE_SIGN = "__DORIS_DELETE_SIGN__"; static const std::string WHERE_SIGN = "__DORIS_WHERE_SIGN__"; static const std::string VERSION_COL = "__DORIS_VERSION_COL__"; @@ -101,64 +100,10 @@ uint32_t olap_adler32(uint32_t adler, const char* buf, size_t len); // 获取系统当前时间,并将时间转换为字符串 Status gen_timestamp_string(std::string* out_string); -// iterator offset,用于二分查找 -using iterator_offset_t = size_t; - -class BinarySearchIterator : public std::iterator_traits<iterator_offset_t*> { -public: - BinarySearchIterator() : _offset(0u) {} - explicit BinarySearchIterator(iterator_offset_t offset) : _offset(offset) {} - - iterator_offset_t operator*() const { return _offset; } - - BinarySearchIterator& operator++() { - ++_offset; - return *this; - } - - BinarySearchIterator& operator--() { - --_offset; - return *this; - } - - BinarySearchIterator& operator-=(size_t step) { - _offset = _offset - step; - return *this; - } - - BinarySearchIterator& operator+=(size_t step) { - _offset = _offset + step; - return *this; - } - - bool operator!=(const BinarySearchIterator& iterator) { - return this->_offset != iterator._offset; - } - -private: - iterator_offset_t _offset; -}; - -int operator-(const BinarySearchIterator& left, const BinarySearchIterator& right); - -// 不用sse4指令的crc32c的计算函数 -unsigned int crc32c_lut(char const* b, unsigned int off, unsigned int len, unsigned int crc); - Status check_datapath_rw(const std::string& path); Status read_write_test_file(const std::string& test_file_path); -//转换两个list -template <typename T1, typename T2> -void static_cast_assign_vector(std::vector<T1>* v1, const std::vector<T2>& v2) { - if (nullptr != v1) { - //GCC3.4的模板展开貌似有问题, 这里如果使用迭代器会编译失败 - for (size_t i = 0; i < v2.size(); i++) { - v1->push_back(static_cast<T1>(v2[i])); - } - } -} - // 打印Errno class Errno { public: @@ -172,8 +117,6 @@ private: static __thread char _buf[BUF_SIZE]; }; -#define ENDSWITH(str, suffix) ((str).rfind(suffix) == (str).size() - strlen(suffix)) - // 检查int8_t, int16_t, int32_t, int64_t的值是否溢出 template <typename T> bool valid_signed_number(const std::string& value_str) { --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org