dead code elimination

This commit is contained in:
Christian Grothoff 2019-06-18 11:25:38 +02:00
parent b3cbe01079
commit 6066ffcb9b
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC
9 changed files with 43 additions and 115 deletions

View File

@ -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);

View File

@ -1845,34 +1845,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!

View File

@ -114,22 +114,6 @@ enum TEH_KS_DenominationKeyUse {
};
/**
* 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 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!

View File

@ -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,

View File

@ -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;
}

View File

@ -319,40 +319,18 @@ 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.
*
@ -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,

View File

@ -152,24 +152,10 @@ 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.
*
@ -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);
/**

View File

@ -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 ();

View File

@ -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 ();