diff options
Diffstat (limited to 'util')
-rw-r--r-- | util/comparator.cc | 18 | ||||
-rw-r--r-- | util/env.cc | 12 |
2 files changed, 16 insertions, 14 deletions
diff --git a/util/comparator.cc b/util/comparator.cc index 26d1eb3..c5766e9 100644 --- a/util/comparator.cc +++ b/util/comparator.cc @@ -2,32 +2,34 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. See the AUTHORS file for names of contributors. +#include "leveldb/comparator.h" + #include <algorithm> #include <cstdint> #include <string> +#include <type_traits> -#include "leveldb/comparator.h" #include "leveldb/slice.h" #include "util/logging.h" #include "util/no_destructor.h" namespace leveldb { -Comparator::~Comparator() {} +Comparator::~Comparator() = default; namespace { class BytewiseComparatorImpl : public Comparator { public: - BytewiseComparatorImpl() {} + BytewiseComparatorImpl() = default; - virtual const char* Name() const { return "leveldb.BytewiseComparator"; } + const char* Name() const override { return "leveldb.BytewiseComparator"; } - virtual int Compare(const Slice& a, const Slice& b) const { + int Compare(const Slice& a, const Slice& b) const override { return a.compare(b); } - virtual void FindShortestSeparator(std::string* start, - const Slice& limit) const { + void FindShortestSeparator(std::string* start, + const Slice& limit) const override { // Find length of common prefix size_t min_length = std::min(start->size(), limit.size()); size_t diff_index = 0; @@ -49,7 +51,7 @@ class BytewiseComparatorImpl : public Comparator { } } - virtual void FindShortSuccessor(std::string* key) const { + void FindShortSuccessor(std::string* key) const override { // Find first character that can be incremented size_t n = key->size(); for (size_t i = 0; i < n; i++) { diff --git a/util/env.cc b/util/env.cc index 6cd5f2e..d2f0aef 100644 --- a/util/env.cc +++ b/util/env.cc @@ -6,21 +6,21 @@ namespace leveldb { -Env::~Env() {} +Env::~Env() = default; Status Env::NewAppendableFile(const std::string& fname, WritableFile** result) { return Status::NotSupported("NewAppendableFile", fname); } -SequentialFile::~SequentialFile() {} +SequentialFile::~SequentialFile() = default; -RandomAccessFile::~RandomAccessFile() {} +RandomAccessFile::~RandomAccessFile() = default; -WritableFile::~WritableFile() {} +WritableFile::~WritableFile() = default; -Logger::~Logger() {} +Logger::~Logger() = default; -FileLock::~FileLock() {} +FileLock::~FileLock() = default; void Log(Logger* info_log, const char* format, ...) { if (info_log != nullptr) { |