summaryrefslogtreecommitdiff
path: root/table
diff options
context:
space:
mode:
authorcostan <costan@google.com>2017-09-01 11:44:05 -0700
committerVictor Costan <pwnall@chromium.org>2017-09-01 14:41:01 -0700
commit141e7671359d5e6c65ff70460774b53b94371df1 (patch)
treea14eecb49f31bb4faac36307118d7e7a68f4fa09 /table
parent09a3c8e7417547829b94bcdaa62cdf9e896f29a9 (diff)
downloadleveldb-141e7671359d5e6c65ff70460774b53b94371df1.tar.gz
Simplify Table::Open() flow and remove a delete call.
------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=167303843
Diffstat (limited to 'table')
-rw-r--r--table/table.cc11
1 files changed, 3 insertions, 8 deletions
diff --git a/table/table.cc b/table/table.cc
index decf808..ff73cee 100644
--- a/table/table.cc
+++ b/table/table.cc
@@ -55,22 +55,19 @@ Status Table::Open(const Options& options,
if (!s.ok()) return s;
// Read the index block
- BlockContents contents;
- Block* index_block = NULL;
+ BlockContents index_block_contents;
if (s.ok()) {
ReadOptions opt;
if (options.paranoid_checks) {
opt.verify_checksums = true;
}
- s = ReadBlock(file, opt, footer.index_handle(), &contents);
- if (s.ok()) {
- index_block = new Block(contents);
- }
+ s = ReadBlock(file, opt, footer.index_handle(), &index_block_contents);
}
if (s.ok()) {
// We've successfully read the footer and the index block: we're
// ready to serve requests.
+ Block* index_block = new Block(index_block_contents);
Rep* rep = new Table::Rep;
rep->options = options;
rep->file = file;
@@ -81,8 +78,6 @@ Status Table::Open(const Options& options,
rep->filter = NULL;
*table = new Table(rep);
(*table)->ReadMeta(footer);
- } else {
- delete index_block;
}
return s;