diff options
author | Christian Grothoff <christian@grothoff.org> | 2019-06-18 11:25:38 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2019-06-18 11:25:38 +0200 |
commit | 6066ffcb9b07f9e2709d0382afa3fc05c52e21c7 (patch) | |
tree | 6f08cc9e4b38aea696b52755afc0565dd1f2c4a9 /src | |
parent | b3cbe01079ea1044f8d1f8bf47e995443efe8390 (diff) |
dead code elimination
Diffstat (limited to 'src')
-rw-r--r-- | src/exchange/taler-exchange-aggregator.c | 10 | ||||
-rw-r--r-- | src/exchange/taler-exchange-httpd_keystate.c | 28 | ||||
-rw-r--r-- | src/exchange/taler-exchange-httpd_keystate.h | 16 | ||||
-rw-r--r-- | src/exchange/taler-exchange-httpd_payback.c | 18 | ||||
-rw-r--r-- | src/exchange/taler-exchange-httpd_refresh_reveal.c | 25 | ||||
-rw-r--r-- | src/exchange/taler-exchange-httpd_responses.c | 32 | ||||
-rw-r--r-- | src/exchange/taler-exchange-httpd_responses.h | 25 | ||||
-rw-r--r-- | src/exchange/test_taler_exchange_aggregator.c | 2 | ||||
-rw-r--r-- | src/exchange/test_taler_exchange_wirewatch.c | 2 |
9 files changed, 43 insertions, 115 deletions
diff --git a/src/exchange/taler-exchange-aggregator.c b/src/exchange/taler-exchange-aggregator.c index fda0ad509..9b1c7e3ee 100644 --- a/src/exchange/taler-exchange-aggregator.c +++ b/src/exchange/taler-exchange-aggregator.c @@ -620,19 +620,19 @@ refund_by_coin_cb (void *cls, const struct TALER_Amount *amount_with_fee, const struct TALER_Amount *refund_fee) { - struct AggregationUnit *au = cls; + struct AggregationUnit *aux = cls; /* TODO: potential optimization: include these conditions in the SELECT! */ if (0 != GNUNET_memcmp (merchant_pub, - &au->merchant_pub)) + &aux->merchant_pub)) return GNUNET_OK; /* different merchant */ if (0 != GNUNET_memcmp (h_contract, - au->h_contract)) + aux->h_contract)) return GNUNET_OK; /* different contract */ if (GNUNET_OK != - TALER_amount_subtract (&au->total_amount, - &au->total_amount, + TALER_amount_subtract (&aux->total_amount, + &aux->total_amount, amount_with_fee)) { GNUNET_break (0); diff --git a/src/exchange/taler-exchange-httpd_keystate.c b/src/exchange/taler-exchange-httpd_keystate.c index 7d6bb08a3..6134faf34 100644 --- a/src/exchange/taler-exchange-httpd_keystate.c +++ b/src/exchange/taler-exchange-httpd_keystate.c @@ -1846,34 +1846,6 @@ TEH_KS_acquire_ (struct GNUNET_TIME_Absolute now, /** - * Look up the issue for a denom public key. - * - * @param key_state state to look in - * @param denom_pub denomination public key - * @param use purpose for which the key is being located - * @return the denomination key issue, - * or NULL if denom_pub could not be found - */ -struct TALER_EXCHANGEDB_DenominationKeyIssueInformation * -TEH_KS_denomination_key_lookup (const struct TEH_KS_StateHandle *key_state, - const struct TALER_DenominationPublicKey *denom_pub, - enum TEH_KS_DenominationKeyUse use) -{ - struct GNUNET_HashCode hc; - - GNUNET_CRYPTO_rsa_public_key_hash (denom_pub->rsa_public_key, - &hc); - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Looking for denom: '%s..'\n", - TALER_B2S (&hc)); - - return TEH_KS_denomination_key_lookup_by_hash (key_state, - &hc, - use); -} - - -/** * Look up the issue for a denom public key. Note that the result * is only valid while the @a key_state is not released! * diff --git a/src/exchange/taler-exchange-httpd_keystate.h b/src/exchange/taler-exchange-httpd_keystate.h index c9b982306..e197e7acc 100644 --- a/src/exchange/taler-exchange-httpd_keystate.h +++ b/src/exchange/taler-exchange-httpd_keystate.h @@ -119,22 +119,6 @@ enum TEH_KS_DenominationKeyUse { * is only valid while the @a key_state is not released! * * @param key_state state to look in - * @param denom_pub denomination public key - * @param use purpose for which the key is being located - * @return the denomination key issue, - * or NULL if denom_pub could not be found (or is not valid at this time for the given @a use) - */ -struct TALER_EXCHANGEDB_DenominationKeyIssueInformation * -TEH_KS_denomination_key_lookup (const struct TEH_KS_StateHandle *key_state, - const struct TALER_DenominationPublicKey *denom_pub, - enum TEH_KS_DenominationKeyUse use); - - -/** - * Look up the issue for a denom public key. Note that the result - * is only valid while the @a key_state is not released! - * - * @param key_state state to look in * @param denom_pub_hash hash of denomination public key * @param use purpose for which the key is being located * @return the denomination key issue, diff --git a/src/exchange/taler-exchange-httpd_payback.c b/src/exchange/taler-exchange-httpd_payback.c index 06181519f..643b9fba9 100644 --- a/src/exchange/taler-exchange-httpd_payback.c +++ b/src/exchange/taler-exchange-httpd_payback.c @@ -315,7 +315,6 @@ verify_and_execute_payback (struct MHD_Connection *connection, struct GNUNET_HashCode c_hash; char *coin_ev; size_t coin_ev_size; - int mhd_ret; /* check denomination exists and is in payback mode */ key_state = TEH_KS_acquire (GNUNET_TIME_absolute_get ()); @@ -414,14 +413,17 @@ verify_and_execute_payback (struct MHD_Connection *connection, pc.coin_sig = coin_sig; pc.coin_bks = coin_bks; pc.coin = coin; - if (GNUNET_OK != - TEH_DB_run_transaction (connection, - "run payback", - &mhd_ret, - &payback_transaction, - &pc)) - return mhd_ret; + { + int mhd_ret; + if (GNUNET_OK != + TEH_DB_run_transaction (connection, + "run payback", + &mhd_ret, + &payback_transaction, + &pc)) + return mhd_ret; + } return reply_payback_success (connection, &coin->coin_pub, &pc.reserve_pub, diff --git a/src/exchange/taler-exchange-httpd_refresh_reveal.c b/src/exchange/taler-exchange-httpd_refresh_reveal.c index 0aee1982c..6fc8d1c5e 100644 --- a/src/exchange/taler-exchange-httpd_refresh_reveal.c +++ b/src/exchange/taler-exchange-httpd_refresh_reveal.c @@ -57,8 +57,6 @@ reply_refresh_reveal_success (struct MHD_Connection *connection, unsigned int num_newcoins, const struct TALER_DenominationSignature *sigs) { - json_t *root; - json_t *obj; json_t *list; int ret; @@ -67,6 +65,8 @@ reply_refresh_reveal_success (struct MHD_Connection *connection, newcoin_index < num_newcoins; newcoin_index++) { + json_t *obj; + obj = json_object (); json_object_set_new (obj, "ev_sig", @@ -75,14 +75,19 @@ reply_refresh_reveal_success (struct MHD_Connection *connection, json_array_append_new (list, obj)); } - root = json_object (); - json_object_set_new (root, - "ev_sigs", - list); - ret = TEH_RESPONSE_reply_json (connection, - root, - MHD_HTTP_OK); - json_decref (root); + + { + json_t *root; + + root = json_object (); + json_object_set_new (root, + "ev_sigs", + list); + ret = TEH_RESPONSE_reply_json (connection, + root, + MHD_HTTP_OK); + json_decref (root); + } return ret; } diff --git a/src/exchange/taler-exchange-httpd_responses.c b/src/exchange/taler-exchange-httpd_responses.c index 234a0107b..8b2420962 100644 --- a/src/exchange/taler-exchange-httpd_responses.c +++ b/src/exchange/taler-exchange-httpd_responses.c @@ -319,41 +319,19 @@ TEH_RESPONSE_reply_signature_invalid (struct MHD_Connection *connection, */ int TEH_RESPONSE_reply_arg_missing (struct MHD_Connection *connection, - enum TALER_ErrorCode ec, + enum TALER_ErrorCode ec, const char *param_name) { return TEH_RESPONSE_reply_json_pack (connection, MHD_HTTP_BAD_REQUEST, "{s:s, s:I, s:s}", "error", "missing parameter", - "code", (json_int_t) ec, + "code", (json_int_t) ec, "parameter", param_name); } /** - * Send a response indicating permission denied. - * - * @param connection the MHD connection to use - * @param ec error code uniquely identifying the error - * @param hint hint about why access was denied - * @return a MHD result code - */ -int -TEH_RESPONSE_reply_permission_denied (struct MHD_Connection *connection, - enum TALER_ErrorCode ec, - const char *hint) -{ - return TEH_RESPONSE_reply_json_pack (connection, - MHD_HTTP_FORBIDDEN, - "{s:s, s:I, s:s}", - "error", "permission denied", - "code", (json_int_t) ec, - "hint", hint); -} - - -/** * Send a response indicating an internal error. * * @param connection the MHD connection to use @@ -363,14 +341,14 @@ TEH_RESPONSE_reply_permission_denied (struct MHD_Connection *connection, */ int TEH_RESPONSE_reply_internal_error (struct MHD_Connection *connection, - enum TALER_ErrorCode ec, + enum TALER_ErrorCode ec, const char *hint) { return TEH_RESPONSE_reply_json_pack (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, "{s:s, s:I, s:s}", "error", "internal error", - "code", (json_int_t) ec, + "code", (json_int_t) ec, "hint", hint); } @@ -385,7 +363,7 @@ TEH_RESPONSE_reply_internal_error (struct MHD_Connection *connection, */ int TEH_RESPONSE_reply_external_error (struct MHD_Connection *connection, - enum TALER_ErrorCode ec, + enum TALER_ErrorCode ec, const char *hint) { return TEH_RESPONSE_reply_json_pack (connection, diff --git a/src/exchange/taler-exchange-httpd_responses.h b/src/exchange/taler-exchange-httpd_responses.h index 1e504fd63..9b1271569 100644 --- a/src/exchange/taler-exchange-httpd_responses.h +++ b/src/exchange/taler-exchange-httpd_responses.h @@ -152,25 +152,11 @@ TEH_RESPONSE_reply_arg_unknown (struct MHD_Connection *connection, */ int TEH_RESPONSE_reply_arg_missing (struct MHD_Connection *connection, - enum TALER_ErrorCode ec, + enum TALER_ErrorCode ec, const char *param_name); /** - * Send a response indicating permission denied. - * - * @param connection the MHD connection to use - * @param ec error code uniquely identifying the error - * @param hint hint about why access was denied - * @return a MHD result code - */ -int -TEH_RESPONSE_reply_permission_denied (struct MHD_Connection *connection, - enum TALER_ErrorCode ec, - const char *hint); - - -/** * Send a response indicating an internal error. * * @param connection the MHD connection to use @@ -180,7 +166,7 @@ TEH_RESPONSE_reply_permission_denied (struct MHD_Connection *connection, */ int TEH_RESPONSE_reply_internal_error (struct MHD_Connection *connection, - enum TALER_ErrorCode ec, + enum TALER_ErrorCode ec, const char *hint); @@ -194,7 +180,7 @@ TEH_RESPONSE_reply_internal_error (struct MHD_Connection *connection, */ int TEH_RESPONSE_reply_external_error (struct MHD_Connection *connection, - enum TALER_ErrorCode ec, + enum TALER_ErrorCode ec, const char *hint); @@ -208,7 +194,8 @@ TEH_RESPONSE_reply_external_error (struct MHD_Connection *connection, */ int TEH_RESPONSE_reply_commit_error (struct MHD_Connection *connection, - enum TALER_ErrorCode ec); + enum TALER_ErrorCode ec); + /** * Send a response indicating a failure to talk to the Exchange's @@ -220,7 +207,7 @@ TEH_RESPONSE_reply_commit_error (struct MHD_Connection *connection, */ int TEH_RESPONSE_reply_internal_db_error (struct MHD_Connection *connection, - enum TALER_ErrorCode ec); + enum TALER_ErrorCode ec); /** diff --git a/src/exchange/test_taler_exchange_aggregator.c b/src/exchange/test_taler_exchange_aggregator.c index c0d3d912f..b02c976af 100644 --- a/src/exchange/test_taler_exchange_aggregator.c +++ b/src/exchange/test_taler_exchange_aggregator.c @@ -1277,7 +1277,7 @@ main (int argc, { fprintf (stderr, "Required port %u not available, skipping.\n", - 8082); + (unsigned int) 8082); return 77; } cfg = GNUNET_CONFIGURATION_create (); diff --git a/src/exchange/test_taler_exchange_wirewatch.c b/src/exchange/test_taler_exchange_wirewatch.c index 8c1210da2..4a23bdb5c 100644 --- a/src/exchange/test_taler_exchange_wirewatch.c +++ b/src/exchange/test_taler_exchange_wirewatch.c @@ -815,7 +815,7 @@ main (int argc, { fprintf (stderr, "Required port %u not available, skipping.\n", - 8082); + (unsigned int) 8082); return 77; } cfg = GNUNET_CONFIGURATION_create (); |