gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [taler-exchange] 04/05: Batch CMD needs to memcpy CMDs in i


From: gnunet
Subject: [GNUnet-SVN] [taler-exchange] 04/05: Batch CMD needs to memcpy CMDs in its internal status.
Date: Wed, 20 Jun 2018 22:20:58 +0200

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

marcello pushed a commit to branch master
in repository exchange.

commit d5684648f9e47fd49f8c699191b8740de783b1b8
Author: Marcello Stanisci <address@hidden>
AuthorDate: Wed Jun 20 14:07:01 2018 +0200

    Batch CMD needs to memcpy CMDs in its internal status.
---
 src/exchange-lib/testing_api_cmd_batch.c | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/src/exchange-lib/testing_api_cmd_batch.c 
b/src/exchange-lib/testing_api_cmd_batch.c
index 84cc308..1ebaa79 100644
--- a/src/exchange-lib/testing_api_cmd_batch.c
+++ b/src/exchange-lib/testing_api_cmd_batch.c
@@ -34,7 +34,7 @@
 struct BatchState
 {
   /* CMDs batch.  */
-  const struct TALER_TESTING_Command *batch;
+  struct TALER_TESTING_Command *batch;
 
   /* Internal comand pointer.  */
   unsigned int batch_ip;
@@ -57,7 +57,10 @@ batch_run (void *cls,
 
   /* hit end command, leap to next top-level command.  */
   if (NULL == bs->batch[bs->batch_ip].label)
+  {
     TALER_TESTING_interpreter_next (is);
+    return;
+  }
 
   bs->batch[bs->batch_ip].run (bs->batch[bs->batch_ip].cls,
                                &bs->batch[bs->batch_ip],
@@ -84,6 +87,7 @@ batch_cleanup (void *cls,
        i++)
     bs->batch[i].cleanup (bs->batch[i].cls,
                           &bs->batch[i]);
+  GNUNET_free_non_null (bs->batch);
 }
 
 
@@ -105,9 +109,20 @@ TALER_TESTING_cmd_batch (const char *label,
 {
   struct TALER_TESTING_Command cmd;
   struct BatchState *bs;
+  unsigned int i;
 
   bs = GNUNET_new (struct BatchState);
-  bs->batch = batch;
+
+  /* Get number of commands.  */
+  for (i=0;NULL != batch[i].label;i++)
+    /* noop */
+    ;
+
+  bs->batch = GNUNET_new_array (i + 1,
+                                struct TALER_TESTING_Command);
+  memcpy (bs->batch,
+          batch,
+          sizeof (struct TALER_TESTING_Command) * i);
 
   cmd.cls = bs;
   cmd.label = label;

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

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