diff options
author | John Wiegley <johnw@newartisans.com> | 2004-09-27 18:08:48 -0400 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2004-09-27 18:08:48 -0400 |
commit | ba2c04072c2f6b1fc50dc8ff3a41098ea6e634e6 (patch) | |
tree | f32580aa14d2628f3fc27e663f8778c30632ca34 | |
parent | eb6861e192281b612e115c8b3bf240e574bca835 (diff) | |
download | fork-ledger-ba2c04072c2f6b1fc50dc8ff3a41098ea6e634e6.tar.gz fork-ledger-ba2c04072c2f6b1fc50dc8ff3a41098ea6e634e6.tar.bz2 fork-ledger-ba2c04072c2f6b1fc50dc8ff3a41098ea6e634e6.zip |
fixed several segfaults (using new option-scrambler test harness)
-rwxr-xr-x | acprep | 4 | ||||
-rw-r--r-- | amount.cc | 6 | ||||
-rw-r--r-- | format.h | 7 | ||||
-rw-r--r-- | walk.h | 6 |
4 files changed, 16 insertions, 7 deletions
@@ -26,6 +26,10 @@ elif [ "$1" = "--opt" ]; then elif [ "$1" = "--flat-opt" ]; then ./configure CPPFLAGS="$INCDIRS" LDFLAGS="$LIBDIRS" \ CXXFLAGS="-fomit-frame-pointer -fastf -mcpu=7450" --disable-shared +elif [ "$1" = "--safe-opt" ]; then + ./configure CPPFLAGS="$INCDIRS" LDFLAGS="$LIBDIRS" \ + CXXFLAGS="-fomit-frame-pointer -fastf -mcpu=7450 -DDEBUG_LEVEL=1" \ + --disable-shared elif [ "$1" = "--perf" ]; then ./configure CPPFLAGS="$INCDIRS" LDFLAGS="$LIBDIRS" CXXFLAGS="-g -pg" fi @@ -489,9 +489,11 @@ amount_t::operator bool() const if (quantity->prec <= commodity().precision) { return mpz_sgn(MPZ(quantity)) != 0; } else { - assert(commodity_); mpz_set(temp, MPZ(quantity)); - mpz_ui_pow_ui(divisor, 10, quantity->prec - commodity().precision); + if (commodity_) + mpz_ui_pow_ui(divisor, 10, quantity->prec - commodity_->precision); + else + mpz_ui_pow_ui(divisor, 10, quantity->prec); mpz_tdiv_q(temp, temp, divisor); bool zero = mpz_sgn(temp) == 0; return ! zero; @@ -115,9 +115,10 @@ class format_entries : public format_transactions void format_last_entry(); virtual void flush() { - format_last_entry(); - last_entry = NULL; - + if (last_entry) { + format_last_entry(); + last_entry = NULL; + } format_transactions::flush(); } virtual void operator()(transaction_t& xact); @@ -306,8 +306,10 @@ class changed_value_transactions : public item_handler<transaction_t> changed_values_only(_changed_values_only), last_xact(NULL) {} virtual void flush() { - output_diff(std::time(NULL)); - last_xact = NULL; + if (last_xact) { + output_diff(std::time(NULL)); + last_xact = NULL; + } item_handler<transaction_t>::flush(); } |