From 168277d2e0a8945d3efc75c4d6006d946f3c6bd6 Mon Sep 17 00:00:00 2001 From: Hao Lee <1838249551@qq.com> Date: Thu, 25 May 2023 11:15:35 +0800 Subject: [PATCH 1/3] fix:fix build error Signed-off-by: Hao Lee <1838249551@qq.com> --- src/pstd/include/pstd_status.h | 2 +- src/pstd/src/posix.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pstd/include/pstd_status.h b/src/pstd/include/pstd_status.h index d3336cd3b5..a3f1dc189e 100644 --- a/src/pstd/include/pstd_status.h +++ b/src/pstd/include/pstd_status.h @@ -114,7 +114,7 @@ inline void Status::operator=(const Status& s) { // and the common case where both s and *this are ok. if (state_ != s.state_) { delete[] state_; - state_ = !s.state_ ? nullptr : CopyStte(s.state_); + state_ = !s.state_ ? nullptr : CopyState(s.state_); } } diff --git a/src/pstd/src/posix.cc b/src/pstd/src/posix.cc index 300c46252f..de2009e77f 100644 --- a/src/pstd/src/posix.cc +++ b/src/pstd/src/posix.cc @@ -384,7 +384,7 @@ struct hostent* Gethostbyname(const char* name) { struct hostent* Gethostbyaddr(const char* addr, int len, int type) { struct hostent* p; - if (!(p = gethostbyaddr(addr, len, type)) { + if (!(p = gethostbyaddr(addr, len, type))) { LOG(ERROR) << "Gethostbyaddr error: DNS error " << h_errno; } return p; From b508696192f936c0a67ee5818fc4fc65e40601a6 Mon Sep 17 00:00:00 2001 From: Hao Lee <1838249551@qq.com> Date: Thu, 25 May 2023 11:18:16 +0800 Subject: [PATCH 2/3] style:disable check bool implicit convert in clang-tidy Signed-off-by: Hao Lee <1838249551@qq.com> --- .clang-tidy | 1 + 1 file changed, 1 insertion(+) diff --git a/.clang-tidy b/.clang-tidy index c6d98c08cd..dd9e39d382 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -43,6 +43,7 @@ Checks: ' -google-runtime-int, -clang-diagnostic-unused-command-line-argument, -clang-diagnostic-ignored-optimization-argument, + -readability-implicit-bool-conversion, ' # CheckOptions: # - { key: readability-identifier-naming.ClassCase, value: CamelCase } From 9f902dd5bf72a6467c337d0be74d9155ff543977 Mon Sep 17 00:00:00 2001 From: Hao Lee <1838249551@qq.com> Date: Thu, 25 May 2023 11:35:01 +0800 Subject: [PATCH 3/3] style:update code style Signed-off-by: Hao Lee <1838249551@qq.com> --- src/net/src/backend_thread.cc | 2 +- src/pika_partition.cc | 1 - src/pika_repl_client_conn.cc | 1 - src/pstd/src/base_conf.cc | 2 +- src/storage/src/redis_sets.cc | 2 +- 5 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/net/src/backend_thread.cc b/src/net/src/backend_thread.cc index eecb027d52..0da8504678 100644 --- a/src/net/src/backend_thread.cc +++ b/src/net/src/backend_thread.cc @@ -322,7 +322,7 @@ void BackendThread::ProcessNotifyEvents(const NetFiredEvent* pfe) { std::lock_guard l(mu_); if (ti.notify_type() == kNotiWrite) { if (conns_.find(fd) == conns_.end()) { - // TODO: need clean and notify? + // TODO(): need clean and notify? continue; } else { // connection exist diff --git a/src/pika_partition.cc b/src/pika_partition.cc index 6ecc9626b4..e46c6216ee 100644 --- a/src/pika_partition.cc +++ b/src/pika_partition.cc @@ -16,7 +16,6 @@ using pstd::Status; -extern std::unique_ptr g_pika_conf; extern PikaServer* g_pika_server; extern std::unique_ptr g_pika_rm; diff --git a/src/pika_repl_client_conn.cc b/src/pika_repl_client_conn.cc index cbb6664df4..041c2ffa29 100644 --- a/src/pika_repl_client_conn.cc +++ b/src/pika_repl_client_conn.cc @@ -16,7 +16,6 @@ using pstd::Status; -extern std::unique_ptr g_pika_conf; extern PikaServer* g_pika_server; extern std::unique_ptr g_pika_rm; diff --git a/src/pstd/src/base_conf.cc b/src/pstd/src/base_conf.cc index eec0099160..14f01c4080 100644 --- a/src/pstd/src/base_conf.cc +++ b/src/pstd/src/base_conf.cc @@ -21,7 +21,7 @@ static const int kConfItemLen = 1024 * 1024; BaseConf::BaseConf(const std::string& path) : rep_(std::make_unique(path)) {} -BaseConf::~BaseConf() {} +BaseConf::~BaseConf() = default; int BaseConf::LoadConf() { if (!FileExists(rep_->path)) { diff --git a/src/storage/src/redis_sets.cc b/src/storage/src/redis_sets.cc index de8f6fa05f..e0a2e3eefb 100644 --- a/src/storage/src/redis_sets.cc +++ b/src/storage/src/redis_sets.cc @@ -25,7 +25,7 @@ RedisSets::RedisSets(Storage* const s, const DataType& type) : Redis(s, type) { spop_counts_store_->SetCapacity(1000); } -RedisSets::~RedisSets() {} +RedisSets::~RedisSets() = default; rocksdb::Status RedisSets::Open(const StorageOptions& storage_options, const std::string& db_path) { statistics_store_->SetCapacity(storage_options.statistics_max_size);