Skip to content

Commit 5f140df

Browse files
committed
Delint.
1 parent 563f734 commit 5f140df

File tree

6 files changed

+18
-14
lines changed

6 files changed

+18
-14
lines changed

include/bitcoin/database/impl/primitives/hashmap.ipp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,6 @@ bool CLASS::put(const Link& link, const Key& key,
308308
const Element& element) NOEXCEPT
309309
{
310310
using namespace system;
311-
const auto count = element.count();
312311
const auto ptr = manager_.get(link);
313312
if (!ptr)
314313
return false;
@@ -319,7 +318,11 @@ bool CLASS::put(const Link& link, const Key& key,
319318
sink.skip_bytes(Link::size);
320319
sink.write_bytes(key);
321320

322-
if constexpr (!is_slab) { BC_DEBUG_ONLY(sink.set_limit(Size * count);) }
321+
if constexpr (!is_slab)
322+
{
323+
BC_DEBUG_ONLY(sink.set_limit(Size * element.count());)
324+
}
325+
323326
auto& next = unsafe_array_cast<uint8_t, Link::size>(ptr->begin());
324327
return element.to_data(sink) && head_.push(link, next, head_.index(key));
325328
}

include/bitcoin/database/impl/primitives/head2.ipp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ Link CLASS::index(const Key& key) const NOEXCEPT
5757
{
5858
// Key is the logical bucket index (no-hash).
5959
if (key < buckets())
60-
return manager::cast_link(key);
60+
return manager<Link, system::data_array<zero>, Link::size>::
61+
cast_link(key);
6162

6263
return {};
6364
}

include/bitcoin/database/impl/primitives/iterator.ipp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
#ifndef LIBBITCOIN_DATABASE_PRIMITIVES_ELEMENT_IPP
2020
#define LIBBITCOIN_DATABASE_PRIMITIVES_ELEMENT_IPP
2121

22-
#include <algorithm>
23-
#include <utility>
22+
#include <iterator>
23+
#include <cstring>
2424
#include <bitcoin/system.hpp>
2525
#include <bitcoin/database/define.hpp>
2626

@@ -78,13 +78,13 @@ Link CLASS::to_match(Link link) const NOEXCEPT
7878
// element key matches (found)
7979
const auto key_ptr = std::next(offset, Link::size);
8080
if (is_zero(std::memcmp(key_.data(), key_ptr, array_count<Key>)))
81-
return std::move(link);
81+
return link;
8282

8383
// set next element link (loop)
8484
link = system::unsafe_array_cast<uint8_t, Link::size>(offset);
8585
}
8686

87-
return std::move(link);
87+
return link;
8888
}
8989

9090
TEMPLATE
@@ -100,7 +100,7 @@ Link CLASS::to_next(Link link) const NOEXCEPT
100100
// set next element link (loop)
101101
link = { system::unsafe_array_cast<uint8_t, Link::size>(offset) };
102102
if (link.is_terminal())
103-
return std::move(link);
103+
return link;
104104

105105
// get next element offset (fault)
106106
offset = memory_->offset(manager::link_to_position(link));
@@ -110,10 +110,10 @@ Link CLASS::to_next(Link link) const NOEXCEPT
110110
// next element key matches (found)
111111
const auto key_ptr = std::next(offset, Link::size);
112112
if (is_zero(std::memcmp(key_.data(), key_ptr, array_count<Key>)))
113-
return std::move(link);
113+
return link;
114114
}
115115

116-
return std::move(link);
116+
return link;
117117
}
118118

119119
} // namespace database

include/bitcoin/database/primitives/head2.hpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,6 @@ class head2
6666
bool push(const bytes& current, const Link& index) NOEXCEPT;
6767

6868
private:
69-
using manager = manager<Link, system::data_array<zero>, Link::size>;
70-
7169
template <size_t Bytes>
7270
static auto& array_cast(memory::iterator buffer) NOEXCEPT
7371
{

test/memory/map.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -481,6 +481,8 @@ BOOST_AUTO_TEST_CASE(map__set__no_minimum_expansion__expected_capacity)
481481

482482
BOOST_AUTO_TEST_CASE(map__set__loaded__expected_fill)
483483
{
484+
BC_PUSH_WARNING(NO_POINTER_ARITHMETIC)
485+
484486
constexpr auto half_rate = 50_size;
485487
constexpr auto minimum = 1_size;
486488
constexpr auto size1 = 3_size;
@@ -575,6 +577,8 @@ BOOST_AUTO_TEST_CASE(map__set__loaded__expected_fill)
575577
BOOST_REQUIRE(!instance.unload());
576578
BOOST_REQUIRE(!instance.close());
577579
BOOST_REQUIRE(!instance.get_fault());
580+
581+
BC_POP_WARNING()
578582
}
579583

580584
BOOST_AUTO_TEST_CASE(map__get__unloaded__false)

test/primitives/hashmap2.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,6 @@ struct record4 { static constexpr size_t size = 4; };
4949
using slab_table = hashmap_<link5, key10, slab0::size>;
5050
using record_table = hashmap_<link5, key10, record4::size>;
5151

52-
constexpr auto element_size = link5::size + array_count<key10> + record4::size;
53-
5452
// record hashmap
5553
// ----------------------------------------------------------------------------
5654

0 commit comments

Comments
 (0)