summaryrefslogtreecommitdiff
path: root/amount.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2004-08-26 14:31:50 -0400
committerJohn Wiegley <johnw@newartisans.com>2004-08-26 14:31:50 -0400
commit942943323ea1cef85b08935c98fb84b378519d3e (patch)
tree2b22049e784a1eb3a1ac78a6ac408af9b4f66992 /amount.cc
parent5f30c790dbc4a3ff469eb350e98817edd38d5de8 (diff)
downloadfork-ledger-942943323ea1cef85b08935c98fb84b378519d3e.tar.gz
fork-ledger-942943323ea1cef85b08935c98fb84b378519d3e.tar.bz2
fork-ledger-942943323ea1cef85b08935c98fb84b378519d3e.zip
don't placement new() amount_t in binary.cc when it isn't necessary
Diffstat (limited to 'amount.cc')
-rw-r--r--amount.cc10
1 files changed, 4 insertions, 6 deletions
diff --git a/amount.cc b/amount.cc
index e0507c7c..a99f7d73 100644
--- a/amount.cc
+++ b/amount.cc
@@ -906,15 +906,13 @@ void amount_t::write_quantity(std::ostream& out) const
void amount_t::read_quantity(std::istream& in)
{
- assert(! quantity);
-
char byte;
in.read(&byte, sizeof(byte));
- if (byte == 0)
- return;
-
- if (byte == 1) {
+ if (byte == 0) {
+ quantity = NULL;
+ }
+ else if (byte == 1) {
quantity = new(bigints_next++) bigint_t;
quantity->flags |= BIGINT_BULK_ALLOC;