removing dead code, using more named constants, checking return values better

This commit is contained in:
Christian Grothoff 2020-03-01 17:51:46 +01:00
parent c11475c081
commit 113f3891d1
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC
9 changed files with 25 additions and 28 deletions

View File

@ -232,7 +232,7 @@ signal_loop (void)
}
if (EINTR == errno)
{
ret = 2;
/* ignore, do the loop again */
continue;
}
switch (c)

View File

@ -772,7 +772,7 @@ get_denomination_info_by_hash (const struct GNUNET_HashCode *dh,
NULL);
if (qs <= 0)
{
if (0 == qs)
if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qs)
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Denomination %s not found\n",
TALER_B2S (dh));
@ -3774,10 +3774,10 @@ refresh_session_cb (void *cls,
cc->qs = qs;
return GNUNET_SYSERR;
}
if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
check_known_coin (coin_pub,
denom_pub,
amount_with_fee))
qs = check_known_coin (coin_pub,
denom_pub,
amount_with_fee);
if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != qs)
{
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
cc->qs = qs;
@ -4152,10 +4152,10 @@ deposit_cb (void *cls,
cc->qs = qs;
return GNUNET_SYSERR;
}
if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
check_known_coin (coin_pub,
denom_pub,
amount_with_fee))
qs = check_known_coin (coin_pub,
denom_pub,
amount_with_fee);
if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != qs)
{
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
cc->qs = qs;

View File

@ -405,6 +405,7 @@ update_fees (struct WireAccount *wa,
&p->master_sig);
if (qs < 0)
{
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
TALER_EXCHANGEDB_fees_free (wa->af);
wa->af = NULL;
return NULL;
@ -854,10 +855,9 @@ deposit_cb (void *cls,
au->session);
if (NULL == af)
{
if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qs)
qs = GNUNET_DB_STATUS_HARD_ERROR;
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
return qs;
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Could not get or persist wire fees. Aborting run.\n");
return GNUNET_DB_STATUS_HARD_ERROR;
}
au->wire_fee = af->wire_fee;
}

View File

@ -615,6 +615,8 @@ handle_mhd_request (void *cls,
/* strange, should start with '/', treat as just "/" */
url = "/";
start = strchr (url + 1, '/');
if (NULL == start)
start = "";
ret = proceed_with_handler (ecls->rh,
connection,
start,

View File

@ -2338,7 +2338,7 @@ TEH_KS_sign (const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose,
/* This *can* happen if the exchange's keys are
not properly maintained. */
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
_ ("Cannot sign request, no valid keys available\n"));
"Cannot sign request, no valid keys available\n");
return GNUNET_SYSERR;
}
*pub = key_state->current_sign_key_issue.issue.signkey_pub;

View File

@ -434,7 +434,7 @@ track_transfer_transaction (void *cls,
if (0 >= qs)
{
if ( (GNUNET_DB_STATUS_HARD_ERROR == qs) ||
(GNUNET_DB_STATUS_SUCCESS_NO_RESULTS) )
(GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qs) )
{
GNUNET_break (0);
*mhd_ret = TALER_MHD_reply_with_error (connection,

View File

@ -403,7 +403,7 @@ load_terms (struct TALER_MHD_Legal *legal,
GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING,
"fstat",
fn);
(void) close (fd);
GNUENT_break (0 == close (fd));
GNUNET_free (fn);
return;
}
@ -412,7 +412,7 @@ load_terms (struct TALER_MHD_Legal *legal,
GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING,
"fstat-size",
fn);
(void) close (fd);
GNUNET_break (0 == close (fd));
GNUNET_free (fn);
return;
}
@ -427,7 +427,7 @@ load_terms (struct TALER_MHD_Legal *legal,
{
GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING,
"malloc");
(void) close (fd);
GNUNET_break (0 == close (fd));
GNUNET_free (fn);
return;
}
@ -440,12 +440,12 @@ load_terms (struct TALER_MHD_Legal *legal,
GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING,
"read",
fn);
(void) close (fd);
GNUNET_break (0 == close (fd));
GNUNET_free (buf);
GNUNET_free (fn);
return;
}
(void) close (fd);
GNUNET_break (0 == close (fd));
GNUNET_free (fn);
/* append to global list of terms of service */
@ -501,7 +501,7 @@ load_language (struct TALER_MHD_Legal *legal,
continue;
load_terms (legal, path, lang, fn);
}
closedir (d);
GNUNET_break (0 == closedir (d));
GNUNET_free (dname);
}
@ -577,7 +577,7 @@ TALER_MHD_legal_load (const struct GNUNET_CONFIGURATION_Handle *cfg,
continue;
load_language (legal, path, lang);
}
closedir (d);
GNUNET_break (0 == closedir (d));
GNUNET_free (path);
return legal;
}

View File

@ -248,8 +248,6 @@ qconv_round_time (void *cls,
GNUNET_assert (sizeof (struct GNUNET_TIME_AbsoluteNBO) == data_len);
GNUNET_assert (scratch_length > 0);
GNUNET_break (NULL == cls);
if (1 != param_length)
return -1;
tmp = *at;
GNUNET_assert (GNUNET_OK ==
GNUNET_TIME_round_abs (&tmp));
@ -316,8 +314,6 @@ qconv_round_time_abs (void *cls,
GNUNET_assert (1 == param_length);
GNUNET_assert (sizeof (struct GNUNET_TIME_AbsoluteNBO) == data_len);
GNUNET_break (NULL == cls);
if (1 != param_length)
return -1;
tmp = GNUNET_TIME_absolute_ntoh (*at);
GNUNET_assert (GNUNET_OK ==
GNUNET_TIME_round_abs (&tmp));

View File

@ -430,7 +430,6 @@ TALER_TESTING_prepare_fakebank (const char *config_filename,
GNUNET_CONFIGURATION_destroy (cfg);
return GNUNET_SYSERR;
}
bc->exchange_auth.method = TALER_BANK_AUTH_NONE;
{
char *exchange_xtalerbank_account;