gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-merchant] 276/277: avoid allocation


From: gnunet
Subject: [taler-merchant] 276/277: avoid allocation
Date: Sun, 05 Jul 2020 20:53:09 +0200

This is an automated email from the git hooks/post-receive script.

grothoff pushed a commit to branch master
in repository merchant.

commit df3b47466499d0d937f3d53b259ae8efc8961aa8
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Sat Jul 4 12:42:16 2020 +0200

    avoid allocation
---
 src/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
index f25005c..eaa7e64 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);
 }
 

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]