diff options
author | Chris Mumford <cmumford@google.com> | 2019-05-02 11:01:00 -0700 |
---|---|---|
committer | Victor Costan <pwnall@chromium.org> | 2019-05-02 19:04:50 -0700 |
commit | 297e66afc1dda3f3d7a7cc2022030164c302cb7a (patch) | |
tree | c7266d464e3b361a8f580ebe1e67c128e7e2a712 /table/merger.cc | |
parent | 3724030179716fd8d95cf79339884c49afade8f9 (diff) | |
download | leveldb-297e66afc1dda3f3d7a7cc2022030164c302cb7a.tar.gz |
Format all files IAW the Google C++ Style Guide.
Use clang-format to correct formatting to be in agreement with the [Google C++ Style Guide](https://google.github.io/styleguide/cppguide.html). Doing this simplifies the process of accepting changes. Also fixed a few warnings flagged by clang-tidy.
PiperOrigin-RevId: 246350737
Diffstat (limited to 'table/merger.cc')
-rw-r--r-- | table/merger.cc | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/table/merger.cc b/table/merger.cc index e079680..3a5c3e4 100644 --- a/table/merger.cc +++ b/table/merger.cc @@ -24,13 +24,9 @@ class MergingIterator : public Iterator { } } - virtual ~MergingIterator() { - delete[] children_; - } + virtual ~MergingIterator() { delete[] children_; } - virtual bool Valid() const { - return (current_ != nullptr); - } + virtual bool Valid() const { return (current_ != nullptr); } virtual void SeekToFirst() { for (int i = 0; i < n_; i++) { @@ -145,10 +141,7 @@ class MergingIterator : public Iterator { IteratorWrapper* current_; // Which direction is the iterator moving? - enum Direction { - kForward, - kReverse - }; + enum Direction { kForward, kReverse }; Direction direction_; }; @@ -169,7 +162,7 @@ void MergingIterator::FindSmallest() { void MergingIterator::FindLargest() { IteratorWrapper* largest = nullptr; - for (int i = n_-1; i >= 0; i--) { + for (int i = n_ - 1; i >= 0; i--) { IteratorWrapper* child = &children_[i]; if (child->Valid()) { if (largest == nullptr) { @@ -183,14 +176,15 @@ void MergingIterator::FindLargest() { } } // namespace -Iterator* NewMergingIterator(const Comparator* cmp, Iterator** list, int n) { +Iterator* NewMergingIterator(const Comparator* comparator, Iterator** children, + int n) { assert(n >= 0); if (n == 0) { return NewEmptyIterator(); } else if (n == 1) { - return list[0]; + return children[0]; } else { - return new MergingIterator(cmp, list, n); + return new MergingIterator(comparator, children, n); } } |