summaryrefslogtreecommitdiff
path: root/src/amount.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2009-10-29 05:37:39 -0400
committerJohn Wiegley <johnw@newartisans.com>2009-10-29 05:37:39 -0400
commit20a6d51cf1dfb0696b548081f807eb856943c9db (patch)
tree5873ff047b152d6a80e18a0964a2e4c912c4497d /src/amount.cc
parent2af8b0555a3fcf3618bc1aca178e7d6b8f8d80ca (diff)
downloadfork-ledger-20a6d51cf1dfb0696b548081f807eb856943c9db.tar.gz
fork-ledger-20a6d51cf1dfb0696b548081f807eb856943c9db.tar.bz2
fork-ledger-20a6d51cf1dfb0696b548081f807eb856943c9db.zip
Renamed bigint_t::refc, for consistency with value_t
Diffstat (limited to 'src/amount.cc')
-rw-r--r--src/amount.cc28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/amount.cc b/src/amount.cc
index a6788af9..6cf3a30b 100644
--- a/src/amount.cc
+++ b/src/amount.cc
@@ -56,25 +56,25 @@ struct amount_t::bigint_t : public supports_flags<>
mpq_t val;
precision_t prec;
- uint_least16_t ref;
+ uint_least16_t refc;
#define MP(bigint) ((bigint)->val)
- bigint_t() : prec(0), ref(1) {
+ bigint_t() : prec(0), refc(1) {
TRACE_CTOR(bigint_t, "");
mpq_init(val);
}
bigint_t(const bigint_t& other)
: supports_flags<>(static_cast<uint_least8_t>
(other.flags() & ~BIGINT_BULK_ALLOC)),
- prec(other.prec), ref(1) {
+ prec(other.prec), refc(1) {
TRACE_CTOR(bigint_t, "copy");
mpq_init(val);
mpq_set(val, other.val);
}
~bigint_t() {
TRACE_DTOR(bigint_t);
- assert(ref == 0);
+ assert(refc == 0);
mpq_clear(val);
}
@@ -83,8 +83,8 @@ struct amount_t::bigint_t : public supports_flags<>
DEBUG("ledger.validate", "amount_t::bigint_t: prec > 128");
return false;
}
- if (ref > 16535) {
- DEBUG("ledger.validate", "amount_t::bigint_t: ref > 16535");
+ if (refc > 16535) {
+ DEBUG("ledger.validate", "amount_t::bigint_t: refc > 16535");
return false;
}
if (flags() & ~(BIGINT_BULK_ALLOC | BIGINT_KEEP_PREC)) {
@@ -147,8 +147,8 @@ void amount_t::_copy(const amount_t& amt)
} else {
quantity = amt.quantity;
DEBUG("amounts.refs",
- quantity << " ref++, now " << (quantity->ref + 1));
- quantity->ref++;
+ quantity << " refc++, now " << (quantity->refc + 1));
+ quantity->refc++;
}
}
commodity_ = amt.commodity_;
@@ -160,7 +160,7 @@ void amount_t::_dup()
{
VERIFY(valid());
- if (quantity->ref > 1) {
+ if (quantity->refc > 1) {
bigint_t * q = new bigint_t(*quantity);
_release();
quantity = q;
@@ -184,9 +184,9 @@ void amount_t::_release()
{
VERIFY(valid());
- DEBUG("amounts.refs", quantity << " ref--, now " << (quantity->ref - 1));
+ DEBUG("amounts.refs", quantity << " refc--, now " << (quantity->refc - 1));
- if (--quantity->ref == 0) {
+ if (--quantity->refc == 0) {
if (quantity->has_flags(BIGINT_BULK_ALLOC))
quantity->~bigint_t();
else
@@ -920,7 +920,7 @@ bool amount_t::parse(std::istream& in, const parse_flags_t& flags)
quantity = new bigint_t;
safe_holder.reset(quantity);
}
- else if (quantity->ref > 1) {
+ else if (quantity->refc > 1) {
_release();
quantity = new bigint_t;
safe_holder.reset(quantity);
@@ -1095,8 +1095,8 @@ bool amount_t::valid() const
return false;
}
- if (quantity->ref == 0) {
- DEBUG("ledger.validate", "amount_t: quantity->ref == 0");
+ if (quantity->refc == 0) {
+ DEBUG("ledger.validate", "amount_t: quantity->refc == 0");
return false;
}
}