Found a 22 line (172 tokens) duplication in the following files:
Starting at line 1918 of /home/kfilipek/Development/work/pmemkv/src/engines-experimental/stree/persistent_b_tree.h
Starting at line 1960 of /home/kfilipek/Development/work/pmemkv/src/engines-experimental/stree/persistent_b_tree.h
b_tree_base<Key, T, Compare, degree>::split_leaf_node(pool_base &pop,
leaf_pptr &split_leaf, K &&key,
M &&obj)
{
assert(split_leaf->full());
leaf_pptr node;
std::pair<iterator, bool> result(nullptr, false);
auto middle = split_leaf->begin() + split_leaf->size() / 2;
bool less = compare(std::forward<K>(key), middle->first);
// move second half into node and insert new element where needed
pmem::obj::transaction::run(pop, [&] {
node = allocate_leaf();
node->move(pop, split_leaf, compare);
/* insert entry(key, obj) into needed half */
if (less) {
result = internal_insert(split_leaf, std::forward<K>(key),
std::forward<M>(obj));
} else {
result = internal_insert(node, std::forward<K>(key),
std::forward<M>(obj));
}
ISSUE: Duplication reported by PMD tool
Environment Information
Please provide a reproduction of the bug:
Details
I removed API related duplications.