-rename TALER_amount_get_zero to TALER_amount_set_zero

This commit is contained in:
Christian Grothoff 2021-07-23 13:02:04 +02:00
parent 23e0847188
commit 306a08a71c
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC
18 changed files with 89 additions and 89 deletions

View File

@ -399,16 +399,16 @@ check_transaction_history_for_deposit (
"Checking transaction history of coin %s\n",
TALER_B2S (coin_pub));
GNUNET_assert (GNUNET_OK ==
TALER_amount_get_zero (TALER_ARL_currency,
TALER_amount_set_zero (TALER_ARL_currency,
&expenditures));
GNUNET_assert (GNUNET_OK ==
TALER_amount_get_zero (TALER_ARL_currency,
TALER_amount_set_zero (TALER_ARL_currency,
&refunds));
GNUNET_assert (GNUNET_OK ==
TALER_amount_get_zero (TALER_ARL_currency,
TALER_amount_set_zero (TALER_ARL_currency,
merchant_gain));
GNUNET_assert (GNUNET_OK ==
TALER_amount_get_zero (TALER_ARL_currency,
TALER_amount_set_zero (TALER_ARL_currency,
&merchant_loss));
/* Go over transaction history to compute totals; note that we do not bother
to reconstruct the order of the events, so instead of subtracting we
@ -625,7 +625,7 @@ check_transaction_history_for_deposit (
as a NEGATIVE contribution as that is not allowed; so
let's count it as zero as that's the best we can do. */
GNUNET_assert (GNUNET_OK ==
TALER_amount_get_zero (TALER_ARL_currency,
TALER_amount_set_zero (TALER_ARL_currency,
merchant_gain));
}
else
@ -1055,7 +1055,7 @@ check_wire_out_cb (void *cls,
wcc.qs = GNUNET_DB_STATUS_SUCCESS_ONE_RESULT;
wcc.date = date;
GNUNET_assert (GNUNET_OK ==
TALER_amount_get_zero (amount->currency,
TALER_amount_set_zero (amount->currency,
&wcc.total_deposits));
if (GNUNET_OK !=
TALER_JSON_merchant_wire_signature_hash (wire,
@ -1339,28 +1339,28 @@ run (void *cls,
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Starting audit\n");
GNUNET_assert (GNUNET_OK ==
TALER_amount_get_zero (TALER_ARL_currency,
TALER_amount_set_zero (TALER_ARL_currency,
&total_aggregation_fee_income));
GNUNET_assert (GNUNET_OK ==
TALER_amount_get_zero (TALER_ARL_currency,
TALER_amount_set_zero (TALER_ARL_currency,
&total_wire_out_delta_plus));
GNUNET_assert (GNUNET_OK ==
TALER_amount_get_zero (TALER_ARL_currency,
TALER_amount_set_zero (TALER_ARL_currency,
&total_wire_out_delta_minus));
GNUNET_assert (GNUNET_OK ==
TALER_amount_get_zero (TALER_ARL_currency,
TALER_amount_set_zero (TALER_ARL_currency,
&total_arithmetic_delta_plus));
GNUNET_assert (GNUNET_OK ==
TALER_amount_get_zero (TALER_ARL_currency,
TALER_amount_set_zero (TALER_ARL_currency,
&total_arithmetic_delta_minus));
GNUNET_assert (GNUNET_OK ==
TALER_amount_get_zero (TALER_ARL_currency,
TALER_amount_set_zero (TALER_ARL_currency,
&total_coin_delta_plus));
GNUNET_assert (GNUNET_OK ==
TALER_amount_get_zero (TALER_ARL_currency,
TALER_amount_set_zero (TALER_ARL_currency,
&total_coin_delta_minus));
GNUNET_assert (GNUNET_OK ==
TALER_amount_get_zero (TALER_ARL_currency,
TALER_amount_set_zero (TALER_ARL_currency,
&total_bad_sig_loss));
GNUNET_assert (NULL !=
(report_row_inconsistencies

View File

@ -480,13 +480,13 @@ check_coin_history (const struct TALER_CoinSpendPublicKeyP *coin_pub,
return qs;
GNUNET_assert (GNUNET_OK ==
TALER_amount_get_zero (value->currency,
TALER_amount_set_zero (value->currency,
&refunded));
GNUNET_assert (GNUNET_OK ==
TALER_amount_get_zero (value->currency,
TALER_amount_set_zero (value->currency,
&spent));
GNUNET_assert (GNUNET_OK ==
TALER_amount_get_zero (value->currency,
TALER_amount_set_zero (value->currency,
&deposit_fee));
have_refund = GNUNET_NO;
for (struct TALER_EXCHANGEDB_TransactionList *pos = tl;
@ -695,16 +695,16 @@ init_denomination (const struct GNUNET_HashCode *denom_hash,
else
{
GNUNET_assert (GNUNET_OK ==
TALER_amount_get_zero (TALER_ARL_currency,
TALER_amount_set_zero (TALER_ARL_currency,
&ds->denom_balance));
GNUNET_assert (GNUNET_OK ==
TALER_amount_get_zero (TALER_ARL_currency,
TALER_amount_set_zero (TALER_ARL_currency,
&ds->denom_loss));
GNUNET_assert (GNUNET_OK ==
TALER_amount_get_zero (TALER_ARL_currency,
TALER_amount_set_zero (TALER_ARL_currency,
&ds->denom_risk));
GNUNET_assert (GNUNET_OK ==
TALER_amount_get_zero (TALER_ARL_currency,
TALER_amount_set_zero (TALER_ARL_currency,
&ds->denom_recoup));
}
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@ -1374,7 +1374,7 @@ refresh_session_cb (void *cls,
/* Check that the resulting amounts are consistent with the value being
refreshed by calculating the total refresh cost */
GNUNET_assert (GNUNET_OK ==
TALER_amount_get_zero (amount_with_fee->currency,
TALER_amount_set_zero (amount_with_fee->currency,
&refresh_cost));
for (unsigned int i = 0; i<reveal_ctx.num_freshcoins; i++)
{
@ -1415,7 +1415,7 @@ refresh_session_cb (void *cls,
/* To continue, best assumption is the melted coin contributed
nothing (=> all withdrawal amounts will be counted as losses) */
GNUNET_assert (GNUNET_OK ==
TALER_amount_get_zero (TALER_ARL_currency,
TALER_amount_set_zero (TALER_ARL_currency,
&amount_without_fee));
}
}
@ -2549,49 +2549,49 @@ run (void *cls,
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Starting audit\n");
GNUNET_assert (GNUNET_OK ==
TALER_amount_get_zero (TALER_ARL_currency,
TALER_amount_set_zero (TALER_ARL_currency,
&reported_emergency_loss));
GNUNET_assert (GNUNET_OK ==
TALER_amount_get_zero (TALER_ARL_currency,
TALER_amount_set_zero (TALER_ARL_currency,
&reported_emergency_risk_by_amount));
GNUNET_assert (GNUNET_OK ==
TALER_amount_get_zero (TALER_ARL_currency,
TALER_amount_set_zero (TALER_ARL_currency,
&reported_emergency_risk_by_count));
GNUNET_assert (GNUNET_OK ==
TALER_amount_get_zero (TALER_ARL_currency,
TALER_amount_set_zero (TALER_ARL_currency,
&reported_emergency_loss_by_count));
GNUNET_assert (GNUNET_OK ==
TALER_amount_get_zero (TALER_ARL_currency,
TALER_amount_set_zero (TALER_ARL_currency,
&total_escrow_balance));
GNUNET_assert (GNUNET_OK ==
TALER_amount_get_zero (TALER_ARL_currency,
TALER_amount_set_zero (TALER_ARL_currency,
&total_risk));
GNUNET_assert (GNUNET_OK ==
TALER_amount_get_zero (TALER_ARL_currency,
TALER_amount_set_zero (TALER_ARL_currency,
&total_recoup_loss));
GNUNET_assert (GNUNET_OK ==
TALER_amount_get_zero (TALER_ARL_currency,
TALER_amount_set_zero (TALER_ARL_currency,
&total_irregular_recoups));
GNUNET_assert (GNUNET_OK ==
TALER_amount_get_zero (TALER_ARL_currency,
TALER_amount_set_zero (TALER_ARL_currency,
&total_deposit_fee_income));
GNUNET_assert (GNUNET_OK ==
TALER_amount_get_zero (TALER_ARL_currency,
TALER_amount_set_zero (TALER_ARL_currency,
&total_melt_fee_income));
GNUNET_assert (GNUNET_OK ==
TALER_amount_get_zero (TALER_ARL_currency,
TALER_amount_set_zero (TALER_ARL_currency,
&total_refund_fee_income));
GNUNET_assert (GNUNET_OK ==
TALER_amount_get_zero (TALER_ARL_currency,
TALER_amount_set_zero (TALER_ARL_currency,
&total_arithmetic_delta_plus));
GNUNET_assert (GNUNET_OK ==
TALER_amount_get_zero (TALER_ARL_currency,
TALER_amount_set_zero (TALER_ARL_currency,
&total_arithmetic_delta_minus));
GNUNET_assert (GNUNET_OK ==
TALER_amount_get_zero (TALER_ARL_currency,
TALER_amount_set_zero (TALER_ARL_currency,
&total_bad_sig_loss));
GNUNET_assert (GNUNET_OK ==
TALER_amount_get_zero (TALER_ARL_currency,
TALER_amount_set_zero (TALER_ARL_currency,
&total_refresh_hanging));
GNUNET_assert (NULL !=
(report_emergencies = json_array ()));

View File

@ -212,7 +212,7 @@ analyze_deposit_confirmations (void *cls)
/* setup 'cc' */
GNUNET_assert (GNUNET_OK ==
TALER_amount_get_zero (TALER_ARL_currency,
TALER_amount_set_zero (TALER_ARL_currency,
&dcc.missed_amount));
dcc.qs = GNUNET_DB_STATUS_SUCCESS_ONE_RESULT;
dcc.missed_count = 0LLU;

View File

@ -326,10 +326,10 @@ load_auditor_reserve_summary (struct ReserveSummary *rs)
{
rs->had_ri = GNUNET_NO;
GNUNET_assert (GNUNET_OK ==
TALER_amount_get_zero (rs->total_in.currency,
TALER_amount_set_zero (rs->total_in.currency,
&rs->balance_at_previous_audit));
GNUNET_assert (GNUNET_OK ==
TALER_amount_get_zero (rs->total_in.currency,
TALER_amount_set_zero (rs->total_in.currency,
&rs->a_withdraw_fee_balance));
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Creating fresh reserve `%s' with starting balance %s\n",
@ -426,10 +426,10 @@ handle_reserve_in (void *cls,
rs->reserve_pub = *reserve_pub;
rs->total_in = *credit;
GNUNET_assert (GNUNET_OK ==
TALER_amount_get_zero (credit->currency,
TALER_amount_set_zero (credit->currency,
&rs->total_out));
GNUNET_assert (GNUNET_OK ==
TALER_amount_get_zero (credit->currency,
TALER_amount_set_zero (credit->currency,
&rs->total_fee));
if (0 > (qs = load_auditor_reserve_summary (rs)))
{
@ -612,10 +612,10 @@ handle_reserve_out (void *cls,
rs->reserve_pub = *reserve_pub;
rs->total_out = auditor_amount_with_fee;
GNUNET_assert (GNUNET_OK ==
TALER_amount_get_zero (amount_with_fee->currency,
TALER_amount_set_zero (amount_with_fee->currency,
&rs->total_in));
GNUNET_assert (GNUNET_OK ==
TALER_amount_get_zero (amount_with_fee->currency,
TALER_amount_set_zero (amount_with_fee->currency,
&rs->total_fee));
qs = load_auditor_reserve_summary (rs);
if (0 > qs)
@ -800,10 +800,10 @@ handle_recoup_by_reserve (
rs->reserve_pub = *reserve_pub;
rs->total_in = *amount;
GNUNET_assert (GNUNET_OK ==
TALER_amount_get_zero (amount->currency,
TALER_amount_set_zero (amount->currency,
&rs->total_out));
GNUNET_assert (GNUNET_OK ==
TALER_amount_get_zero (amount->currency,
TALER_amount_set_zero (amount->currency,
&rs->total_fee));
qs = load_auditor_reserve_summary (rs);
if (0 > qs)
@ -939,7 +939,7 @@ handle_reserve_closed (
rs->total_out = *amount_with_fee;
rs->total_fee = *closing_fee;
GNUNET_assert (GNUNET_OK ==
TALER_amount_get_zero (amount_with_fee->currency,
TALER_amount_set_zero (amount_with_fee->currency,
&rs->total_in));
qs = load_auditor_reserve_summary (rs);
if (0 > qs)
@ -1058,7 +1058,7 @@ verify_reserve_balance (void *cls,
TALER_JSON_from_amount (&loss)));
/* Continue with a reserve balance of zero */
GNUNET_assert (GNUNET_OK ==
TALER_amount_get_zero (balance.currency,
TALER_amount_set_zero (balance.currency,
&nbalance));
}
@ -1226,7 +1226,7 @@ verify_reserve_balance (void *cls,
/* We unexpectedly went negative, so a sane value to continue from
would be zero. */
GNUNET_assert (GNUNET_OK ==
TALER_amount_get_zero (TALER_ARL_currency,
TALER_amount_set_zero (TALER_ARL_currency,
&total_escrow_balance));
}
else
@ -1507,34 +1507,34 @@ run (void *cls,
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Starting audit\n");
GNUNET_assert (GNUNET_OK ==
TALER_amount_get_zero (TALER_ARL_currency,
TALER_amount_set_zero (TALER_ARL_currency,
&total_escrow_balance));
GNUNET_assert (GNUNET_OK ==
TALER_amount_get_zero (TALER_ARL_currency,
TALER_amount_set_zero (TALER_ARL_currency,
&total_irregular_recoups));
GNUNET_assert (GNUNET_OK ==
TALER_amount_get_zero (TALER_ARL_currency,
TALER_amount_set_zero (TALER_ARL_currency,
&total_withdraw_fee_income));
GNUNET_assert (GNUNET_OK ==
TALER_amount_get_zero (TALER_ARL_currency,
TALER_amount_set_zero (TALER_ARL_currency,
&total_balance_insufficient_loss));
GNUNET_assert (GNUNET_OK ==
TALER_amount_get_zero (TALER_ARL_currency,
TALER_amount_set_zero (TALER_ARL_currency,
&total_balance_summary_delta_plus));
GNUNET_assert (GNUNET_OK ==
TALER_amount_get_zero (TALER_ARL_currency,
TALER_amount_set_zero (TALER_ARL_currency,
&total_balance_summary_delta_minus));
GNUNET_assert (GNUNET_OK ==
TALER_amount_get_zero (TALER_ARL_currency,
TALER_amount_set_zero (TALER_ARL_currency,
&total_arithmetic_delta_plus));
GNUNET_assert (GNUNET_OK ==
TALER_amount_get_zero (TALER_ARL_currency,
TALER_amount_set_zero (TALER_ARL_currency,
&total_arithmetic_delta_minus));
GNUNET_assert (GNUNET_OK ==
TALER_amount_get_zero (TALER_ARL_currency,
TALER_amount_set_zero (TALER_ARL_currency,
&total_balance_reserve_not_closed));
GNUNET_assert (GNUNET_OK ==
TALER_amount_get_zero (TALER_ARL_currency,
TALER_amount_set_zero (TALER_ARL_currency,
&total_bad_sig_loss));
GNUNET_assert (NULL !=
(report_row_inconsistencies = json_array ()));

View File

@ -2143,31 +2143,31 @@ run (void *cls,
GNUNET_assert (NULL !=
(report_account_progress = json_array ()));
GNUNET_assert (GNUNET_OK ==
TALER_amount_get_zero (TALER_ARL_currency,
TALER_amount_set_zero (TALER_ARL_currency,
&total_bad_amount_out_plus));
GNUNET_assert (GNUNET_OK ==
TALER_amount_get_zero (TALER_ARL_currency,
TALER_amount_set_zero (TALER_ARL_currency,
&total_bad_amount_out_minus));
GNUNET_assert (GNUNET_OK ==
TALER_amount_get_zero (TALER_ARL_currency,
TALER_amount_set_zero (TALER_ARL_currency,
&total_bad_amount_in_plus));
GNUNET_assert (GNUNET_OK ==
TALER_amount_get_zero (TALER_ARL_currency,
TALER_amount_set_zero (TALER_ARL_currency,
&total_bad_amount_in_minus));
GNUNET_assert (GNUNET_OK ==
TALER_amount_get_zero (TALER_ARL_currency,
TALER_amount_set_zero (TALER_ARL_currency,
&total_missattribution_in));
GNUNET_assert (GNUNET_OK ==
TALER_amount_get_zero (TALER_ARL_currency,
TALER_amount_set_zero (TALER_ARL_currency,
&total_amount_lag));
GNUNET_assert (GNUNET_OK ==
TALER_amount_get_zero (TALER_ARL_currency,
TALER_amount_set_zero (TALER_ARL_currency,
&total_closure_amount_lag));
GNUNET_assert (GNUNET_OK ==
TALER_amount_get_zero (TALER_ARL_currency,
TALER_amount_set_zero (TALER_ARL_currency,
&total_wire_format_amount));
GNUNET_assert (GNUNET_OK ==
TALER_amount_get_zero (TALER_ARL_currency,
TALER_amount_set_zero (TALER_ARL_currency,
&zero));
TALER_EXCHANGEDB_find_accounts (TALER_ARL_cfg,
&process_account_cb,

View File

@ -376,7 +376,7 @@ lookup_account (struct TALER_FAKEBANK_Handle *h,
account = GNUNET_new (struct Account);
account->account_name = GNUNET_strdup (name);
GNUNET_assert (GNUNET_OK ==
TALER_amount_get_zero (h->currency,
TALER_amount_set_zero (h->currency,
&account->balance));
GNUNET_assert (GNUNET_OK ==
GNUNET_CONTAINER_multihashmap_put (h->accounts,

View File

@ -328,7 +328,7 @@ run (void *cls,
GNUNET_asprintf (&amount_5, "%s:5", currency);
GNUNET_asprintf (&amount_4, "%s:4", currency);
GNUNET_asprintf (&amount_1, "%s:1", currency);
GNUNET_assert (GNUNET_OK == TALER_amount_get_zero (currency,
GNUNET_assert (GNUNET_OK == TALER_amount_set_zero (currency,
&total_reserve_amount));
total_reserve_amount.value = 5 * howmany_coins;
GNUNET_asprintf (&withdraw_fee_str,

View File

@ -398,7 +398,7 @@ deposit_cb (void *cls,
(unsigned long long) row_id,
TALER_amount2s (amount_with_fee));
GNUNET_assert (GNUNET_OK ==
TALER_amount_get_zero (au->total_amount.currency,
TALER_amount_set_zero (au->total_amount.currency,
&au->total_amount));
}
else
@ -576,7 +576,7 @@ aggregate_cb (void *cls,
(unsigned long long) row_id,
TALER_amount2s (&au->total_amount));
GNUNET_assert (GNUNET_OK ==
TALER_amount_get_zero (old.currency,
TALER_amount_set_zero (old.currency,
&au->total_amount));
}
else

View File

@ -312,7 +312,7 @@ expired_reserve_cb (void *cls,
without wire transfer. */
closing_fee = *left;
GNUNET_assert (GNUNET_OK ==
TALER_amount_get_zero (left->currency,
TALER_amount_set_zero (left->currency,
&amount_without_fee));
}
/* round down to enable transfer */

View File

@ -212,10 +212,10 @@ recoup_transaction (void *cls,
}
GNUNET_assert (GNUNET_OK ==
TALER_amount_get_zero (pc->value.currency,
TALER_amount_set_zero (pc->value.currency,
&spent));
GNUNET_assert (GNUNET_OK ==
TALER_amount_get_zero (pc->value.currency,
TALER_amount_set_zero (pc->value.currency,
&recouped));
/* Check if this coin has been recouped already at least once */
existing_recoup_found = GNUNET_NO;

View File

@ -841,7 +841,7 @@ TEH_RESPONSE_compile_reserve_history (
{
/* did not encounter any withdraw operations, set withdraw_total to zero */
GNUNET_assert (GNUNET_OK ==
TALER_amount_get_zero (credit_total.currency,
TALER_amount_set_zero (credit_total.currency,
&withdraw_total));
}
if (0 >

View File

@ -44,7 +44,7 @@ TALER_EXCHANGEDB_calculate_transaction_list_totals (
bool have_refund;
GNUNET_assert (GNUNET_OK ==
TALER_amount_get_zero (spent.currency,
TALER_amount_set_zero (spent.currency,
&refunded));
have_refund = false;
for (struct TALER_EXCHANGEDB_TransactionList *pos = tl;

View File

@ -1704,7 +1704,7 @@ run (void *cls)
cbc.reserve_pub = reserve_pub;
cbc.amount_with_fee = value;
GNUNET_assert (GNUNET_OK ==
TALER_amount_get_zero (CURRENCY, &cbc.withdraw_fee));
TALER_amount_set_zero (CURRENCY, &cbc.withdraw_fee));
FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
plugin->insert_withdraw_info (plugin->cls,
session,

View File

@ -156,7 +156,7 @@ TALER_string_to_amount_nbo (const char *str,
* #GNUNET_SYSERR if it is invalid.
*/
enum GNUNET_GenericReturnValue
TALER_amount_get_zero (const char *cur,
TALER_amount_set_zero (const char *cur,
struct TALER_Amount *amount);

View File

@ -58,10 +58,10 @@ TALER_EXCHANGE_parse_reserve_history (
struct TALER_Amount total_out;
GNUNET_assert (GNUNET_OK ==
TALER_amount_get_zero (currency,
TALER_amount_set_zero (currency,
&total_in));
GNUNET_assert (GNUNET_OK ==
TALER_amount_get_zero (currency,
TALER_amount_set_zero (currency,
&total_out));
uuid_off = 0;
for (unsigned int off = 0; off<history_length; off++)
@ -470,10 +470,10 @@ TALER_EXCHANGE_verify_coin_history (
return GNUNET_SYSERR;
}
GNUNET_assert (GNUNET_OK ==
TALER_amount_get_zero (currency,
TALER_amount_set_zero (currency,
total));
GNUNET_assert (GNUNET_OK ==
TALER_amount_get_zero (currency,
TALER_amount_set_zero (currency,
&rtotal));
for (size_t off = 0; off<len; off++)
{

View File

@ -521,7 +521,7 @@ TALER_EXCHANGE_refresh_prepare (
md.melted_coin.expire_deposit
= melt_pk->expire_deposit;
GNUNET_assert (GNUNET_OK ==
TALER_amount_get_zero (melt_amount->currency,
TALER_amount_set_zero (melt_amount->currency,
&total));
md.melted_coin.pub_key.rsa_public_key
= GNUNET_CRYPTO_rsa_public_key_dup (melt_pk->key.rsa_public_key);

View File

@ -113,7 +113,7 @@ check_transfers_get_response_ok (
return GNUNET_SYSERR;
}
if (GNUNET_OK !=
TALER_amount_get_zero (td.total_amount.currency,
TALER_amount_set_zero (td.total_amount.currency,
&total_expected))
{
GNUNET_break_op (0);

View File

@ -214,7 +214,7 @@ TALER_amount_ntoh (struct TALER_Amount *res,
enum GNUNET_GenericReturnValue
TALER_amount_get_zero (const char *cur,
TALER_amount_set_zero (const char *cur,
struct TALER_Amount *amount)
{
size_t slen;
@ -371,7 +371,7 @@ TALER_amount_subtract (struct TALER_Amount *diff,
return TALER_AAR_INVALID_NEGATIVE_RESULT;
}
GNUNET_assert (GNUNET_OK ==
TALER_amount_get_zero (n1.currency,
TALER_amount_set_zero (n1.currency,
diff));
GNUNET_assert (n1.fraction >= n2.fraction);
diff->fraction = n1.fraction - n2.fraction;
@ -414,7 +414,7 @@ TALER_amount_add (struct TALER_Amount *sum,
}
GNUNET_assert (GNUNET_OK ==
TALER_amount_get_zero (a1->currency,
TALER_amount_set_zero (a1->currency,
&res));
res.value = n1.value + n2.value;
if (res.value < n1.value)