don't placement new() amount_t in binary.cc when it isn't necessary
This commit is contained in:
parent
5f30c790db
commit
942943323e
2 changed files with 4 additions and 7 deletions
10
amount.cc
10
amount.cc
|
|
@ -906,15 +906,13 @@ void amount_t::write_quantity(std::ostream& out) const
|
||||||
|
|
||||||
void amount_t::read_quantity(std::istream& in)
|
void amount_t::read_quantity(std::istream& in)
|
||||||
{
|
{
|
||||||
assert(! quantity);
|
|
||||||
|
|
||||||
char byte;
|
char byte;
|
||||||
in.read(&byte, sizeof(byte));
|
in.read(&byte, sizeof(byte));
|
||||||
|
|
||||||
if (byte == 0)
|
if (byte == 0) {
|
||||||
return;
|
quantity = NULL;
|
||||||
|
}
|
||||||
if (byte == 1) {
|
else if (byte == 1) {
|
||||||
quantity = new(bigints_next++) bigint_t;
|
quantity = new(bigints_next++) bigint_t;
|
||||||
quantity->flags |= BIGINT_BULK_ALLOC;
|
quantity->flags |= BIGINT_BULK_ALLOC;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -128,7 +128,6 @@ inline void read_binary_transaction(std::istream& in, transaction_t * xact,
|
||||||
xact->account = accounts[read_binary_number<account_t::ident_t>(in) - 1];
|
xact->account = accounts[read_binary_number<account_t::ident_t>(in) - 1];
|
||||||
xact->account->add_transaction(xact);
|
xact->account->add_transaction(xact);
|
||||||
|
|
||||||
new ((amount_t *) &xact->amount) amount_t;
|
|
||||||
read_binary_amount(in, xact->amount);
|
read_binary_amount(in, xact->amount);
|
||||||
|
|
||||||
if (read_binary_number<char>(in) == 1) {
|
if (read_binary_number<char>(in) == 1) {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue