summaryrefslogtreecommitdiff
path: root/table/block_builder.cc
diff options
context:
space:
mode:
authorChris Mumford <cmumford@google.com>2019-05-02 11:01:00 -0700
committerVictor Costan <pwnall@chromium.org>2019-05-02 19:04:50 -0700
commit297e66afc1dda3f3d7a7cc2022030164c302cb7a (patch)
treec7266d464e3b361a8f580ebe1e67c128e7e2a712 /table/block_builder.cc
parent3724030179716fd8d95cf79339884c49afade8f9 (diff)
downloadleveldb-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/block_builder.cc')
-rw-r--r--table/block_builder.cc21
1 files changed, 10 insertions, 11 deletions
diff --git a/table/block_builder.cc b/table/block_builder.cc
index db660cd..f7cb1b0 100644
--- a/table/block_builder.cc
+++ b/table/block_builder.cc
@@ -28,8 +28,10 @@
#include "table/block_builder.h"
-#include <algorithm>
#include <assert.h>
+
+#include <algorithm>
+
#include "leveldb/comparator.h"
#include "leveldb/table_builder.h"
#include "util/coding.h"
@@ -37,27 +39,24 @@
namespace leveldb {
BlockBuilder::BlockBuilder(const Options* options)
- : options_(options),
- restarts_(),
- counter_(0),
- finished_(false) {
+ : options_(options), restarts_(), counter_(0), finished_(false) {
assert(options->block_restart_interval >= 1);
- restarts_.push_back(0); // First restart point is at offset 0
+ restarts_.push_back(0); // First restart point is at offset 0
}
void BlockBuilder::Reset() {
buffer_.clear();
restarts_.clear();
- restarts_.push_back(0); // First restart point is at offset 0
+ restarts_.push_back(0); // First restart point is at offset 0
counter_ = 0;
finished_ = false;
last_key_.clear();
}
size_t BlockBuilder::CurrentSizeEstimate() const {
- return (buffer_.size() + // Raw data buffer
- restarts_.size() * sizeof(uint32_t) + // Restart array
- sizeof(uint32_t)); // Restart array length
+ return (buffer_.size() + // Raw data buffer
+ restarts_.size() * sizeof(uint32_t) + // Restart array
+ sizeof(uint32_t)); // Restart array length
}
Slice BlockBuilder::Finish() {
@@ -74,7 +73,7 @@ void BlockBuilder::Add(const Slice& key, const Slice& value) {
Slice last_key_piece(last_key_);
assert(!finished_);
assert(counter_ <= options_->block_restart_interval);
- assert(buffer_.empty() // No values yet?
+ assert(buffer_.empty() // No values yet?
|| options_->comparator->Compare(key, last_key_piece) > 0);
size_t shared = 0;
if (counter_ < options_->block_restart_interval) {