From 3a042c5b305e658ef028975d527582d85faee49d Mon Sep 17 00:00:00 2001 From: ArcueidType <981354012@qq.com> Date: Tue, 10 Dec 2024 09:55:03 +0800 Subject: [PATCH] clear useless code --- db/db_impl.cc | 2 +- db/fields.cc | 10 ---------- db/fields.h | 2 -- 3 files changed, 1 insertion(+), 13 deletions(-) diff --git a/db/db_impl.cc b/db/db_impl.cc index 97b43ae..565fbba 100644 --- a/db/db_impl.cc +++ b/db/db_impl.cc @@ -1222,7 +1222,7 @@ std::vector DBImpl::FindKeysByField(Field &field) { std::string key = iter->key().ToString(); Fields fields = iter->fields(); - if (fields.find(field.first) == field.second) { + if (fields[field.first] == field.second) { keys.emplace_back(key); } iter->Next(); diff --git a/db/fields.cc b/db/fields.cc index 1281627..dd37277 100644 --- a/db/fields.cc +++ b/db/fields.cc @@ -69,14 +69,4 @@ namespace leveldb { return field_array; } - - std::string Fields::find(const std::string& field_name) const { - auto it = this->_fields.find(field_name); - if (it == this->_fields.end()) { - return ""; - } - return it->second; - } - - } // namespace leveldb \ No newline at end of file diff --git a/db/fields.h b/db/fields.h index 9cfc5a9..411a29b 100644 --- a/db/fields.h +++ b/db/fields.h @@ -33,8 +33,6 @@ namespace leveldb { // 将Fields编码为存入LevelDB的Value std::string Serialize() const; - // 通过field_name得到相应的字段值 - std::string find(const std::string& field_name) const; private: std::map _fields; };