Skip to content

Commit 7496aa3

Browse files
committed
Style (avoid new), work around bogus vc++ warning.
1 parent 70f2a5d commit 7496aa3

4 files changed

Lines changed: 7 additions & 26 deletions

File tree

include/bitcoin/system/impl/machine/interpreter.ipp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1649,7 +1649,6 @@ connect(const context& state, const transaction& tx,
16491649
return error::script_success;
16501650
}
16511651

1652-
BC_PUSH_WARNING(NO_NEW_OR_DELETE)
16531652
BC_PUSH_WARNING(NO_THROW_IN_NOEXCEPT)
16541653

16551654
template <typename Stack>
@@ -1695,7 +1694,6 @@ code interpreter<Stack>::connect_embedded(const context& state,
16951694
return error::script_success;
16961695
}
16971696

1698-
BC_POP_WARNING()
16991697
BC_POP_WARNING()
17001698

17011699
template <typename Stack>

src/chain/input.cpp

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,19 +48,14 @@ static_assert(max_script_size <
4848
// static/private
4949
const witness& input::no_witness() NOEXCEPT
5050
{
51-
static const chain::witness empty_witness{};
52-
return empty_witness;
51+
static const chain::witness empty{};
52+
return empty;
5353
}
5454

5555
// static/private
5656
const witness::cptr& input::no_witness_cptr() NOEXCEPT
5757
{
58-
BC_PUSH_WARNING(NO_NEW_OR_DELETE)
59-
static const std::shared_ptr<const chain::witness> empty
60-
{
61-
new const chain::witness{}
62-
};
63-
BC_POP_WARNING()
58+
static const auto empty = std::make_shared<const chain::witness>();
6459
return empty;
6560
}
6661

src/chain/operation.cpp

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -45,32 +45,22 @@ static constexpr auto any_invalid = opcode::op_xor;
4545
// static/private
4646
const data_chunk& operation::no_data() NOEXCEPT
4747
{
48-
static const data_chunk empty_data{};
49-
return empty_data;
48+
static const data_chunk empty{};
49+
return empty;
5050
}
5151

5252
// static/private
5353
const chunk_cptr& operation::no_data_cptr() NOEXCEPT
5454
{
55-
BC_PUSH_WARNING(NO_NEW_OR_DELETE)
56-
static const std::shared_ptr<const data_chunk> empty
57-
{
58-
new const data_chunk{}
59-
};
60-
BC_POP_WARNING()
55+
static const auto empty = std::make_shared<const data_chunk>();
6156
return empty;
6257
}
6358

6459
// static/private
6560
// Push data is not possible with an invalid code, combination is invalid.
6661
const chunk_cptr& operation::any_data_cptr() NOEXCEPT
6762
{
68-
BC_PUSH_WARNING(NO_NEW_OR_DELETE)
69-
static const std::shared_ptr<const data_chunk> any
70-
{
71-
new const data_chunk{ 0x42 }
72-
};
73-
BC_POP_WARNING()
63+
static const auto any = to_shared(data_chunk{ 0x42 });
7464
return any;
7565
}
7666

src/crypto/pseudo_random.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ namespace libbitcoin {
3030
namespace system {
3131

3232
BC_PUSH_WARNING(NO_STATIC_CAST)
33-
BC_PUSH_WARNING(NO_NEW_OR_DELETE)
3433
BC_PUSH_WARNING(NO_THROW_IN_NOEXCEPT)
3534
BC_PUSH_WARNING(NO_CASTS_FOR_ARITHMETIC_CONVERSION)
3635

@@ -104,7 +103,6 @@ steady_clock::duration pseudo_random::duration(
104103
BC_POP_WARNING()
105104
BC_POP_WARNING()
106105
BC_POP_WARNING()
107-
BC_POP_WARNING()
108106

109107
} // namespace system
110108
} // namespace libbitcoin

0 commit comments

Comments
 (0)