diff options
author | John Wiegley <johnw@newartisans.com> | 2004-08-21 04:09:07 -0400 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2004-08-21 04:09:07 -0400 |
commit | 6392b0179932738ea055390658551107327c7e86 (patch) | |
tree | e88566e544e9e81c9d71a8ef9277f0747d33c885 /amount.cc | |
parent | b03041698277591677f303afd4c0d715ea844ba8 (diff) | |
download | fork-ledger-6392b0179932738ea055390658551107327c7e86.tar.gz fork-ledger-6392b0179932738ea055390658551107327c7e86.tar.bz2 fork-ledger-6392b0179932738ea055390658551107327c7e86.zip |
moved some debug code around
Diffstat (limited to 'amount.cc')
-rw-r--r-- | amount.cc | 35 |
1 files changed, 19 insertions, 16 deletions
@@ -10,11 +10,24 @@ namespace ledger { #ifdef DEBUG_ENABLED -static int ctors = 0; -static int dtors = 0; +int bigint_ctors = 0; +int bigint_dtors = 0; #endif -struct amount_t::bigint_t { +#ifdef DEBUG_ENABLED +static struct ctor_dtor_info { + ~ctor_dtor_info() { + DEBUG_CLASS("ledger.amount.bigint"); + DEBUG_PRINT_("bigint_t ctor count = " << bigint_ctors); + DEBUG_PRINT_("bigint_t dtor count = " << bigint_dtors); + } +} __info; +#endif + +class amount_t::bigint_t { + bigint_t(const bigint_t&); + + public: mpz_t val; unsigned int ref; unsigned int index; @@ -22,34 +35,24 @@ struct amount_t::bigint_t { bigint_t() : ref(1), index(0) { mpz_init(val); #ifdef DEBUG_ENABLED - ctors++; + bigint_ctors++; #endif } bigint_t(mpz_t _val) : ref(1), index(0) { mpz_init_set(val, _val); #ifdef DEBUG_ENABLED - ctors++; + bigint_ctors++; #endif } ~bigint_t() { assert(ref == 0); mpz_clear(val); #ifdef DEBUG_ENABLED - dtors++; + bigint_dtors++; #endif } }; -#ifdef DEBUG_ENABLED -static struct ctor_dtor_info { - ~ctor_dtor_info() { - DEBUG_CLASS("ledger.amount.bigint"); - DEBUG_PRINT_("bigint_t ctor count = " << ctors); - DEBUG_PRINT_("bigint_t dtor count = " << dtors); - } -} __info; -#endif - #define MPZ(x) ((x)->val) static mpz_t temp; |