remove unnecessary block, use static where applicable

This commit is contained in:
Christian Grothoff 2018-07-03 23:02:49 +02:00
parent 928714d226
commit 2128cf6f41
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC

View File

@ -120,6 +120,7 @@ struct RefreshMeltState
uint16_t noreveal_index; uint16_t noreveal_index;
}; };
/** /**
* State for a "refresh reveal" CMD. * State for a "refresh reveal" CMD.
*/ */
@ -165,6 +166,7 @@ struct RefreshRevealState
unsigned int expected_response_code; unsigned int expected_response_code;
}; };
/** /**
* State for a "refresh link" CMD. * State for a "refresh link" CMD.
*/ */
@ -223,7 +225,6 @@ reveal_cb (void *cls,
const struct TALER_DenominationSignature *sigs, const struct TALER_DenominationSignature *sigs,
const json_t *full_response) const json_t *full_response)
{ {
struct RefreshRevealState *rrs = cls; struct RefreshRevealState *rrs = cls;
const struct TALER_TESTING_Command *melt_cmd; const struct TALER_TESTING_Command *melt_cmd;
@ -281,6 +282,7 @@ reveal_cb (void *cls,
TALER_TESTING_interpreter_next (rrs->is); TALER_TESTING_interpreter_next (rrs->is);
} }
/** /**
* Run the command. * Run the command.
* *
@ -288,7 +290,7 @@ reveal_cb (void *cls,
* @param cmd the command to execute. * @param cmd the command to execute.
* @param is the interpreter state. * @param is the interpreter state.
*/ */
void static void
refresh_reveal_run (void *cls, refresh_reveal_run (void *cls,
const struct TALER_TESTING_Command *cmd, const struct TALER_TESTING_Command *cmd,
struct TALER_TESTING_Interpreter *is) struct TALER_TESTING_Interpreter *is)
@ -331,7 +333,7 @@ refresh_reveal_run (void *cls,
* @param cls closure. * @param cls closure.
* @param cmd the command which is being cleaned up. * @param cmd the command which is being cleaned up.
*/ */
void static void
refresh_reveal_cleanup (void *cls, refresh_reveal_cleanup (void *cls,
const struct TALER_TESTING_Command *cmd) const struct TALER_TESTING_Command *cmd)
{ {
@ -348,13 +350,8 @@ refresh_reveal_cleanup (void *cls,
rrs->rrh = NULL; rrs->rrh = NULL;
} }
{ /* FIXME: why block-ing this? */ for (unsigned int j=0; j < rrs->num_fresh_coins; j++)
unsigned int j; GNUNET_CRYPTO_rsa_signature_free (rrs->fresh_coins[j].sig.rsa_signature);
for (j=0; j < rrs->num_fresh_coins; j++)
GNUNET_CRYPTO_rsa_signature_free
(rrs->fresh_coins[j].sig.rsa_signature);
}
GNUNET_free_non_null (rrs->fresh_coins); GNUNET_free_non_null (rrs->fresh_coins);
rrs->fresh_coins = NULL; rrs->fresh_coins = NULL;
@ -503,7 +500,7 @@ link_cb (void *cls,
* @param cmd the command to execute. * @param cmd the command to execute.
* @param is the interpreter state. * @param is the interpreter state.
*/ */
void static void
refresh_link_run (void *cls, refresh_link_run (void *cls,
const struct TALER_TESTING_Command *cmd, const struct TALER_TESTING_Command *cmd,
struct TALER_TESTING_Interpreter *is) struct TALER_TESTING_Interpreter *is)
@ -575,6 +572,7 @@ refresh_link_run (void *cls,
} }
} }
/** /**
* Free the state of the "refresh link" CMD, and possibly * Free the state of the "refresh link" CMD, and possibly
* cancel a operation thereof. * cancel a operation thereof.
@ -582,7 +580,7 @@ refresh_link_run (void *cls,
* @param cls closure * @param cls closure
* @param cmd the command which is being cleaned up. * @param cmd the command which is being cleaned up.
*/ */
void static void
refresh_link_cleanup (void *cls, refresh_link_cleanup (void *cls,
const struct TALER_TESTING_Command *cmd) const struct TALER_TESTING_Command *cmd)
{ {
@ -647,10 +645,10 @@ melt_cb (void *cls,
rms->double_melt = GNUNET_NO; rms->double_melt = GNUNET_NO;
return; return;
} }
TALER_TESTING_interpreter_next (rms->is); TALER_TESTING_interpreter_next (rms->is);
} }
/** /**
* Run the command. * Run the command.
* *
@ -691,7 +689,6 @@ refresh_melt_run (void *cls,
struct TALER_Amount fresh_amount; struct TALER_Amount fresh_amount;
struct TALER_DenominationSignature *melt_sig; struct TALER_DenominationSignature *melt_sig;
const struct TALER_EXCHANGE_DenomPublicKey *melt_denom_pub; const struct TALER_EXCHANGE_DenomPublicKey *melt_denom_pub;
unsigned int i;
const struct MeltDetails *md = &rms->melted_coin; const struct MeltDetails *md = &rms->melted_coin;
if (NULL == (coin_command if (NULL == (coin_command
@ -723,8 +720,10 @@ refresh_melt_run (void *cls,
TALER_TESTING_interpreter_fail (rms->is); TALER_TESTING_interpreter_fail (rms->is);
return; return;
} }
if (GNUNET_OK != TALER_TESTING_get_trait_denom_sig if (GNUNET_OK !=
(coin_command, 0, &melt_sig)) TALER_TESTING_get_trait_denom_sig (coin_command,
0,
&melt_sig))
{ {
GNUNET_break (0); GNUNET_break (0);
TALER_TESTING_interpreter_fail (rms->is); TALER_TESTING_interpreter_fail (rms->is);
@ -738,7 +737,7 @@ refresh_melt_run (void *cls,
return; return;
} }
for (i=0;i<num_fresh_coins;i++) for (unsigned int i=0;i<num_fresh_coins;i++)
{ {
if (GNUNET_OK != TALER_string_to_amount if (GNUNET_OK != TALER_string_to_amount
(melt_fresh_amounts[i], &fresh_amount)) (melt_fresh_amounts[i], &fresh_amount))
@ -786,6 +785,7 @@ refresh_melt_run (void *cls,
} }
} }
/** /**
* Free the "refresh melt" CMD state, and possibly cancel a * Free the "refresh melt" CMD state, and possibly cancel a
* pending operation thereof. * pending operation thereof.
@ -793,7 +793,7 @@ refresh_melt_run (void *cls,
* @param cls closure, typically a #struct RefreshMeltState. * @param cls closure, typically a #struct RefreshMeltState.
* @param cmd the command which is being cleaned up. * @param cmd the command which is being cleaned up.
*/ */
void static void
refresh_melt_cleanup (void *cls, refresh_melt_cleanup (void *cls,
const struct TALER_TESTING_Command *cmd) const struct TALER_TESTING_Command *cmd)
{ {
@ -814,6 +814,7 @@ refresh_melt_cleanup (void *cls,
rms->refresh_data_length = 0; rms->refresh_data_length = 0;
} }
/** /**
* Offer internal data to the "refresh melt" CMD. * Offer internal data to the "refresh melt" CMD.
* *