Skip to content

Commit c431a60

Browse files
committed
Avoid name conflicts with vc++ memory debugger assumptions.
1 parent 5b9e7f6 commit c431a60

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

include/bitcoin/node/block_arena.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,15 +61,15 @@ class BCN_API block_arena
6161
}
6262

6363
/// Malloc throws if memory is not allocated.
64-
virtual INLINE void* malloc(size_t bytes) THROWS
64+
virtual INLINE void* malloc_(size_t bytes) THROWS
6565
{
6666
BC_PUSH_WARNING(NO_MALLOC_OR_FREE)
6767
return std::malloc(bytes);
6868
BC_POP_WARNING()
6969
}
7070

7171
/// Free does not throw, behavior is undefined if address is incorrect.
72-
virtual INLINE void free(void* address) NOEXCEPT
72+
virtual INLINE void free_(void* address) NOEXCEPT
7373
{
7474
BC_PUSH_WARNING(NO_MALLOC_OR_FREE)
7575
std::free(address);

src/block_arena.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ void block_arena::release(void* address) NOEXCEPT
9494
while (!is_null(address))
9595
{
9696
const auto link = get_link(pointer_cast<uint8_t>(address));
97-
free(address);
97+
free_(address);
9898
address = link;
9999
}
100100
}
@@ -109,7 +109,7 @@ void block_arena::push(size_t minimum) THROWS
109109
// Ensure next allocation accomodates link plus current request.
110110
BC_ASSERT(!is_add_overflow(minimum, link_size));
111111
size_ = std::max(size_, minimum + link_size);
112-
const auto map = pointer_cast<uint8_t>(malloc(size_));
112+
const auto map = pointer_cast<uint8_t>(malloc_(size_));
113113

114114
if (is_null(map))
115115
throw allocation_exception{};

test/block_arena.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,13 +94,13 @@ class accessor
9494
return to_aligned(value, align);
9595
}
9696

97-
void* malloc(size_t bytes) THROWS override
97+
void* malloc_(size_t bytes) THROWS override
9898
{
9999
stack.emplace_back(bytes, 0xff_u8);
100100
return stack.back().data();
101101
}
102102

103-
void free(void* address) NOEXCEPT override
103+
void free_(void* address) NOEXCEPT override
104104
{
105105
freed.push_back(address);
106106
}
@@ -153,7 +153,7 @@ class accessor_null_malloc
153153
public:
154154
using accessor::accessor;
155155

156-
void* malloc(size_t) THROWS override
156+
void* malloc_(size_t) THROWS override
157157
{
158158
return nullptr;
159159
}

0 commit comments

Comments
 (0)