merchant

Merchant backend to process payments, run by merchants
Log | Files | Refs | Submodules | README | LICENSE

commit df3b47466499d0d937f3d53b259ae8efc8961aa8
parent 74e6cc62b8cf935d485d93a578a92615718d2e51
Author: Christian Grothoff <christian@grothoff.org>
Date:   Sat,  4 Jul 2020 12:42:16 +0200

avoid allocation

Diffstat:
Msrc/testing/testing_api_cmd_post_reserves.c | 14+++++---------
1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/src/testing/testing_api_cmd_post_reserves.c b/src/testing/testing_api_cmd_post_reserves.c @@ -70,9 +70,10 @@ struct PostReservesState /** * Public key assigned to the reserve */ - struct TALER_ReservePublicKeyP *reserve_pub; + struct TALER_ReservePublicKeyP reserve_pub; }; + /** * Callbacks of this type are used to work the result of submitting a * POST /reserves request to a merchant @@ -116,9 +117,7 @@ post_reserves_cb (void *cls, "Unhandled HTTP status (%d).\n", hr->http_status); } - prs->reserve_pub = GNUNET_memdup (reserve_pub, - sizeof (struct TALER_ReservePublicKeyP)); - GNUNET_assert (NULL != prs->reserve_pub); + prs->reserve_pub = *reserve_pub; TALER_TESTING_interpreter_next (prs->is); } @@ -141,7 +140,7 @@ post_reserves_traits (void *cls, { struct PostReservesState *prs = cls; struct TALER_TESTING_Trait traits[] = { - TALER_TESTING_make_trait_reserve_pub (0, prs->reserve_pub), + TALER_TESTING_make_trait_reserve_pub (0, &prs->reserve_pub), TALER_TESTING_make_trait_amount_obj (0, &prs->initial_balance), TALER_TESTING_trait_end (), }; @@ -195,11 +194,9 @@ post_reserves_fake_run (void *cls, struct TALER_ReservePrivateKeyP reserve_priv; prs->is = is; - prs->reserve_pub = GNUNET_new (struct TALER_ReservePublicKeyP); - GNUNET_CRYPTO_eddsa_key_create (&reserve_priv.eddsa_priv); GNUNET_CRYPTO_eddsa_key_get_public (&reserve_priv.eddsa_priv, - &prs->reserve_pub->eddsa_pub); + &prs->reserve_pub.eddsa_pub); GNUNET_assert (GNUNET_OK == TALER_string_to_amount ("EUR:100.00", &prs->initial_balance)); @@ -226,7 +223,6 @@ post_reserves_cleanup (void *cls, "POST /reserves operation did not complete\n"); TALER_MERCHANT_reserves_post_cancel (prs->prh); } - GNUNET_free (prs->reserve_pub); GNUNET_free (prs); }