-code cleanup

This commit is contained in:
Christian Grothoff 2022-11-17 16:58:38 +01:00
parent 8e0f06c86b
commit 3d4baa9969
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC
9 changed files with 104 additions and 98 deletions

View File

@ -1484,6 +1484,8 @@ TALER_FAKEBANK_stop (struct TALER_FAKEBANK_Handle *h)
while (NULL != (lp = GNUNET_CONTAINER_heap_remove_root (h->lp_heap)))
lp_trigger (lp,
h);
GNUNET_assert (0 ==
pthread_mutex_unlock (&h->big_lock));
GNUNET_break (sizeof (val) ==
#ifdef __linux__
write (h->lp_event,
@ -1492,8 +1494,6 @@ TALER_FAKEBANK_stop (struct TALER_FAKEBANK_Handle *h)
#endif
&val,
sizeof (val)));
GNUNET_assert (0 ==
pthread_mutex_unlock (&h->big_lock));
GNUNET_break (0 ==
pthread_join (h->lp_thread,
&ret));
@ -3012,7 +3012,7 @@ handle_bank_integration (struct TALER_FAKEBANK_Handle *h,
char dummy;
if (1 != sscanf (lp_s,
"%lld%c",
"%llu%c",
&d,
&dummy))
{
@ -3427,6 +3427,7 @@ post_testing_register (struct TALER_FAKEBANK_Handle *h,
acc = lookup_account (h,
username,
username);
GNUNET_assert (NULL != acc);
acc->password = GNUNET_strdup (password);
acc->balance = h->signup_bonus; /* magic money creation! */
}

View File

@ -232,7 +232,7 @@ withdraw_cs_stage_two_callback (
&wh->pd))
{
GNUNET_break (0);
GNUNET_free (wh);
break;
}
wh->wh2 = TALER_EXCHANGE_withdraw2 (wh->exchange,
&wh->pd,

View File

@ -277,6 +277,7 @@ next (void *closure)
return 1;
}
static int
leave (void *closure)
{
@ -287,12 +288,14 @@ leave (void *closure)
return 0;
}
static void
freecb (void *v)
{
free (v);
}
static int
get (void *closure, const char *name, struct mustach_sbuf *sbuf)
{
@ -331,7 +334,7 @@ get (void *closure, const char *name, struct mustach_sbuf *sbuf)
char *c;
if (! json_is_string (obj))
break;
s = strdup (json_string_value (obj));
s = GNUNET_strdup (json_string_value (obj));
c = strchr (s, ':');
if (NULL != c)
*c = 0;
@ -361,6 +364,7 @@ get (void *closure, const char *name, struct mustach_sbuf *sbuf)
return MUSTACH_OK;
}
static struct mustach_itf itf = {
.start = start,
.put = NULL,
@ -385,21 +389,27 @@ static struct mustach_itf itfuw = {
.stop = NULL
};
int fmustach_jansson (const char *template, json_t *root, FILE *file)
int
fmustach_jansson (const char *template, json_t *root, FILE *file)
{
struct JanssonClosure e = { 0 };
e.root = root;
return fmustach (template, &itf, &e, file);
}
int fdmustach_jansson (const char *template, json_t *root, int fd)
int
fdmustach_jansson (const char *template, json_t *root, int fd)
{
struct JanssonClosure e = { 0 };
e.root = root;
return fdmustach (template, &itf, &e, fd);
}
int mustach_jansson (const char *template, json_t *root, char **result, size_t *size)
int
mustach_jansson (const char *template, json_t *root, char **result,
size_t *size)
{
struct JanssonClosure e = { 0 };
e.root = root;
@ -407,11 +417,13 @@ int mustach_jansson (const char *template, json_t *root, char **result, size_t *
return mustach (template, &itf, &e, result, size);
}
int umustach_jansson (const char *template, json_t *root, mustach_jansson_write_cb writecb, void *closure)
int
umustach_jansson (const char *template, json_t *root, mustach_jansson_write_cb
writecb, void *closure)
{
struct JanssonClosure e = { 0 };
e.root = root;
e.writecb = writecb;
return fmustach (template, &itfuw, &e, closure);
}

View File

@ -115,6 +115,7 @@ get_cb (void *cls,
}
ref = TALER_TESTING_interpreter_lookup_command (ds->is,
ds->contract_ref);
GNUNET_assert (NULL != ref);
if (MHD_HTTP_OK == dr->hr.http_status)
{
const struct TALER_PurseMergePrivateKeyP *mp;

View File

@ -91,6 +91,7 @@ closer_run (void *cls,
rcmd = TALER_TESTING_interpreter_lookup_command (is,
as->reserve_ref);
GNUNET_assert (NULL != rcmd);
if (GNUNET_OK !=
TALER_TESTING_get_trait_reserve_pub (rcmd,
&reserve_pubp))

View File

@ -163,7 +163,7 @@ deposit_cb (void *cls,
purse_cmd = TALER_TESTING_interpreter_lookup_command (ds->is,
ds->purse_ref);
GNUNET_assert (NULL != purse_cmd);
if (GNUNET_OK !=
TALER_TESTING_get_trait_reserve_sig (purse_cmd,
&reserve_sig))
@ -270,6 +270,7 @@ deposit_run (void *cls,
purse_cmd = TALER_TESTING_interpreter_lookup_command (is,
ds->purse_ref);
GNUNET_assert (NULL != purse_cmd);
if (GNUNET_OK !=
TALER_TESTING_get_trait_purse_pub (purse_cmd,
&purse_pub))
@ -291,13 +292,7 @@ deposit_run (void *cls,
coin_cmd = TALER_TESTING_interpreter_lookup_command (is,
cr->command_ref);
if (NULL == coin_cmd)
{
GNUNET_break (0);
TALER_TESTING_interpreter_fail (is);
return;
}
GNUNET_assert (NULL != coin_cmd);
if ( (GNUNET_OK !=
TALER_TESTING_get_trait_coin_priv (coin_cmd,
cr->coin_index,

View File

@ -188,13 +188,7 @@ status_run (void *cls,
create_purse
= TALER_TESTING_interpreter_lookup_command (is,
ss->purse_reference);
if (NULL == create_purse)
{
GNUNET_break (0);
TALER_TESTING_interpreter_fail (is);
return;
}
GNUNET_assert (NULL != create_purse);
if (GNUNET_OK !=
TALER_TESTING_get_trait_purse_pub (create_purse,
&ss->purse_pub))
@ -311,6 +305,7 @@ finish_run (void *cls,
poll_purse
= TALER_TESTING_interpreter_lookup_command (is,
ps->poll_reference);
GNUNET_assert (NULL != poll_purse);
GNUNET_assert (poll_purse->run == &status_run);
ss = poll_purse->cls;
if (NULL == ss->pgh)

View File

@ -183,13 +183,7 @@ status_run (void *cls,
create_reserve
= TALER_TESTING_interpreter_lookup_command (is,
ss->reserve_reference);
if (NULL == create_reserve)
{
GNUNET_break (0);
TALER_TESTING_interpreter_fail (is);
return;
}
GNUNET_assert (NULL != create_reserve);
if (GNUNET_OK !=
TALER_TESTING_get_trait_reserve_pub (create_reserve,
&ss->reserve_pubp))
@ -328,6 +322,7 @@ finish_run (void *cls,
poll_reserve
= TALER_TESTING_interpreter_lookup_command (is,
ps->poll_reference);
GNUNET_assert (NULL != poll_reserve);
GNUNET_assert (poll_reserve->run == &status_run);
ss = poll_reserve->cls;
if (NULL == ss->rsh)

View File

@ -105,6 +105,12 @@ wire_cb (void *cls,
char *method;
method = TALER_payto_get_method (accounts[i].payto_uri);
if (NULL == method)
{
GNUNET_break (0);
TALER_TESTING_interpreter_fail (ws->is);
return;
}
if (0 == strcmp (ws->expected_method,
method))
{