• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

libbitcoin / libbitcoin-system / 9850225493

09 Jul 2024 02:56AM UTC coverage: 82.842% (+0.06%) from 82.783%
9850225493

Pull #1496

github

web-flow
Merge df31ef021 into f7d99416c
Pull Request #1496: Initial own arena implementation.

54 of 56 new or added lines in 6 files covered. (96.43%)

9956 of 12018 relevant lines covered (82.84%)

4803925.77 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

91.67
/src/arena.cpp
1
/**
2
 * Copyright (c) 2011-2024 libbitcoin developers (see AUTHORS)
3
 *
4
 * This file is part of libbitcoin.
5
 *
6
 * This program is free software: you can redistribute it and/or modify
7
 * it under the terms of the GNU Affero General Public License as published by
8
 * the Free Software Foundation, either version 3 of the License, or
9
 * (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU Affero General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU Affero General Public License
17
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
18
 */
19
#include <bitcoin/system/arena.hpp>
20

21
namespace libbitcoin {
22

23

24
void* default_arena::do_allocate(size_t bytes, size_t align) THROWS
3,892,960✔
25
{
26
    if (align > __STDCPP_DEFAULT_NEW_ALIGNMENT__)
3,892,960✔
NEW
27
        throw allocation_exception();
×
28

29
    BC_PUSH_WARNING(NO_NEW_OR_DELETE)
30
    return ::operator new(bytes);
3,892,960✔
31
    BC_POP_WARNING()
32
}
33

34
void default_arena::do_deallocate(void* ptr, size_t bytes, size_t) NOEXCEPT
3,892,960✔
35
{
36
    BC_PUSH_WARNING(NO_NEW_OR_DELETE)
37
    ::operator delete(ptr, &bytes);
3,892,960✔
38
    BC_POP_WARNING()
39
}
3,892,960✔
40

41
bool default_arena::do_is_equal(const arena& other) const NOEXCEPT
1,913,787✔
42
{
43
    // Do not cross the streams.
44
    return &other == this;
1,913,787✔
45
}
46

47
// use bc::default_arena::get() vs. std::pmr::get_default_resource()
48
arena* default_arena::get() NOEXCEPT
3,961,768✔
49
{
50
    static default_arena resource{};
3,961,768✔
51
    return &resource;
3,961,768✔
52
}
53

54
} // namespace libbitcoin
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc