Skip to content

Commit 00250e1

Browse files
committed
Fix linter
1 parent a223b9e commit 00250e1

File tree

1 file changed

+8
-21
lines changed

1 file changed

+8
-21
lines changed

db/compaction/compaction_picker_universal.cc

+8-21
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,9 @@ class UniversalCompactionBuilder {
288288
// and the index of the file in that level
289289

290290
struct InputFileInfo {
291-
InputFileInfo() : f(nullptr), level(0), index(0) {}
291+
InputFileInfo() : InputFileInfo(nullptr, 0, 0) {}
292+
InputFileInfo(FileMetaData* file_meta, size_t l, size_t i)
293+
: f(file_meta), level(l), index(i) {}
292294

293295
FileMetaData* f;
294296
size_t level;
@@ -321,22 +323,14 @@ SmallestKeyHeap create_level_heap(Compaction* c, const Comparator* ucmp) {
321323
SmallestKeyHeap smallest_key_priority_q =
322324
SmallestKeyHeap(SmallestKeyHeapComparator(ucmp));
323325

324-
InputFileInfo input_file;
325-
326326
for (size_t l = 0; l < c->num_input_levels(); l++) {
327327
if (c->num_input_files(l) != 0) {
328328
if (l == 0 && c->start_level() == 0) {
329329
for (size_t i = 0; i < c->num_input_files(0); i++) {
330-
input_file.f = c->input(0, i);
331-
input_file.level = 0;
332-
input_file.index = i;
333-
smallest_key_priority_q.push(std::move(input_file));
330+
smallest_key_priority_q.emplace(c->input(0, i), 0, i);
334331
}
335332
} else {
336-
input_file.f = c->input(l, 0);
337-
input_file.level = l;
338-
input_file.index = 0;
339-
smallest_key_priority_q.push(std::move(input_file));
333+
smallest_key_priority_q.emplace(c->input(l, 0), l, 0);
340334
}
341335
}
342336
}
@@ -374,7 +368,7 @@ bool UniversalCompactionBuilder::IsInputFilesNonOverlapping(Compaction* c) {
374368
auto comparator = icmp_->user_comparator();
375369
int first_iter = 1;
376370

377-
InputFileInfo prev, curr, next;
371+
InputFileInfo prev, curr;
378372

379373
SmallestKeyHeap smallest_key_priority_q =
380374
create_level_heap(c, icmp_->user_comparator());
@@ -397,17 +391,10 @@ bool UniversalCompactionBuilder::IsInputFilesNonOverlapping(Compaction* c) {
397391
prev = curr;
398392
}
399393

400-
next.f = nullptr;
401-
402394
if (c->level(curr.level) != 0 &&
403395
curr.index < c->num_input_files(curr.level) - 1) {
404-
next.f = c->input(curr.level, curr.index + 1);
405-
next.level = curr.level;
406-
next.index = curr.index + 1;
407-
}
408-
409-
if (next.f) {
410-
smallest_key_priority_q.push(std::move(next));
396+
smallest_key_priority_q.emplace(c->input(curr.level, curr.index + 1),
397+
curr.level, curr.index + 1);
411398
}
412399
}
413400
return true;

0 commit comments

Comments
 (0)