summaryrefslogtreecommitdiff
path: root/src/testing
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2020-07-04 12:42:16 +0200
committerChristian Grothoff <christian@grothoff.org>2020-07-04 12:42:16 +0200
commitdf3b47466499d0d937f3d53b259ae8efc8961aa8 (patch)
treeb7c56b94252eaa6f52ae9b09c5d7e95a5d42e04f /src/testing
parent74e6cc62b8cf935d485d93a578a92615718d2e51 (diff)
downloadmerchant-df3b47466499d0d937f3d53b259ae8efc8961aa8.tar.gz
merchant-df3b47466499d0d937f3d53b259ae8efc8961aa8.tar.bz2
merchant-df3b47466499d0d937f3d53b259ae8efc8961aa8.zip
avoid allocation
Diffstat (limited to 'src/testing')
-rw-r--r--src/testing/testing_api_cmd_post_reserves.c14
1 files 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
index f25005c8..eaa7e64e 100644
--- 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);
}