From 0b8a87126b24a9da20f5cd24dca7816f45bc34e0 Mon Sep 17 00:00:00 2001 From: ng0 Date: Mon, 8 Apr 2019 13:24:51 +0000 Subject: Refactor auditor/taler-auditor.c for GNUNET_memcmp --- src/auditor/taler-auditor.c | 45 ++++++++++++++++++--------------------------- 1 file changed, 18 insertions(+), 27 deletions(-) diff --git a/src/auditor/taler-auditor.c b/src/auditor/taler-auditor.c index 1b9c99c84..9d629d1e5 100644 --- a/src/auditor/taler-auditor.c +++ b/src/auditor/taler-auditor.c @@ -1975,12 +1975,10 @@ check_transaction_history (const struct TALER_CoinSpendPublicKeyP *coin_pub, } /* Check if this deposit is within the remit of the aggregation we are investigating, if so, include it in the totals. */ - if ( (0 == memcmp (merchant_pub, - &tl->details.deposit->merchant_pub, - sizeof (struct TALER_MerchantPublicKeyP))) && - (0 == memcmp (h_contract_terms, - &tl->details.deposit->h_contract_terms, - sizeof (struct GNUNET_HashCode))) ) + if ( (0 == GNUNET_memcmp (merchant_pub, + &tl->details.deposit->merchant_pub)) && + (0 == GNUNET_memcmp (h_contract_terms, + &tl->details.deposit->h_contract_terms)) ) { struct TALER_Amount amount_without_fee; @@ -2063,12 +2061,10 @@ check_transaction_history (const struct TALER_CoinSpendPublicKeyP *coin_pub, } /* Check if this refund is within the remit of the aggregation we are investigating, if so, include it in the totals. */ - if ( (0 == memcmp (merchant_pub, - &tl->details.refund->merchant_pub, - sizeof (struct TALER_MerchantPublicKeyP))) && - (0 == memcmp (h_contract_terms, - &tl->details.refund->h_contract_terms, - sizeof (struct GNUNET_HashCode))) ) + if ( (0 == GNUNET_memcmp (merchant_pub, + &tl->details.refund->merchant_pub)) && + (0 == GNUNET_memcmp (h_contract_terms, + &tl->details.refund->h_contract_terms)) ) { if (GNUNET_OK != TALER_amount_add (&merchant_loss, @@ -2223,9 +2219,8 @@ wire_transfer_information_cb (void *cls, return; } if (0 != - memcmp (&hw, - h_wire, - sizeof (struct GNUNET_HashCode))) + GNUNET_memcmp (&hw, + h_wire)) { wcc->qs = GNUNET_DB_STATUS_HARD_ERROR; report_row_inconsistency ("aggregation", @@ -2320,18 +2315,16 @@ wire_transfer_information_cb (void *cls, tl); /* Check other details of wire transfer match */ - if (0 != memcmp (h_wire, - &wcc->h_wire, - sizeof (struct GNUNET_HashCode))) + if (0 != GNUNET_memcmp (h_wire, + &wcc->h_wire)) { wcc->qs = GNUNET_DB_STATUS_HARD_ERROR; report_row_inconsistency ("aggregation", rowid, "wire method of aggregate do not match wire transfer"); } - if (0 != memcmp (h_wire, - &wcc->h_wire, - sizeof (struct GNUNET_HashCode))) + if (0 != GNUNET_memcmp (h_wire, + &wcc->h_wire)) { wcc->qs = GNUNET_DB_STATUS_HARD_ERROR; report_row_inconsistency ("aggregation", @@ -4393,9 +4386,8 @@ test_master_present (void *cls, int *found = cls; (void) exchange_url; - if (0 == memcmp (mpub, - &master_pub, - sizeof (master_pub))) + if (0 == GNUNET_memcmp (mpub, + &master_pub)) *found = GNUNET_YES; } @@ -4423,9 +4415,8 @@ run (void *cls, GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Launching auditor\n"); cfg = c; - if (0 == memcmp (&zeromp, - &master_pub, - sizeof (struct TALER_MasterPublicKeyP))) + if (0 == GNUNET_memcmp (&zeromp, + &master_pub)) { /* -m option not given, try configuration */ char *master_public_key_str; -- cgit v1.2.3