diff options
Diffstat (limited to 'src/testing/testing_api_cmd_batch.c')
-rw-r--r-- | src/testing/testing_api_cmd_batch.c | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/src/testing/testing_api_cmd_batch.c b/src/testing/testing_api_cmd_batch.c index af260f80d..e39489616 100644 --- a/src/testing/testing_api_cmd_batch.c +++ b/src/testing/testing_api_cmd_batch.c | |||
@@ -39,6 +39,11 @@ struct BatchState | |||
39 | struct GNUNET_TESTING_Command *batch; | 39 | struct GNUNET_TESTING_Command *batch; |
40 | 40 | ||
41 | /** | 41 | /** |
42 | * Our label. | ||
43 | */ | ||
44 | const char *label; | ||
45 | |||
46 | /** | ||
42 | * Internal command pointer. | 47 | * Internal command pointer. |
43 | */ | 48 | */ |
44 | unsigned int batch_ip; | 49 | unsigned int batch_ip; |
@@ -49,12 +54,10 @@ struct BatchState | |||
49 | * Run the command. | 54 | * Run the command. |
50 | * | 55 | * |
51 | * @param cls closure. | 56 | * @param cls closure. |
52 | * @param cmd the command being executed. | ||
53 | * @param is the interpreter state. | 57 | * @param is the interpreter state. |
54 | */ | 58 | */ |
55 | static void | 59 | static void |
56 | batch_run (void *cls, | 60 | batch_run (void *cls, |
57 | const struct GNUNET_TESTING_Command *cmd, | ||
58 | struct GNUNET_TESTING_Interpreter *is) | 61 | struct GNUNET_TESTING_Interpreter *is) |
59 | { | 62 | { |
60 | struct BatchState *bs = cls; | 63 | struct BatchState *bs = cls; |
@@ -69,7 +72,7 @@ batch_run (void *cls, | |||
69 | { | 72 | { |
70 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 73 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
71 | "Exiting from batch: %s\n", | 74 | "Exiting from batch: %s\n", |
72 | cmd->label); | 75 | bs->label); |
73 | return; | 76 | return; |
74 | } | 77 | } |
75 | bs->batch[bs->batch_ip].start_time | 78 | bs->batch[bs->batch_ip].start_time |
@@ -77,7 +80,6 @@ batch_run (void *cls, | |||
77 | = GNUNET_TIME_absolute_get (); | 80 | = GNUNET_TIME_absolute_get (); |
78 | bs->batch[bs->batch_ip].num_tries = 1; | 81 | bs->batch[bs->batch_ip].num_tries = 1; |
79 | bs->batch[bs->batch_ip].run (bs->batch[bs->batch_ip].cls, | 82 | bs->batch[bs->batch_ip].run (bs->batch[bs->batch_ip].cls, |
80 | &bs->batch[bs->batch_ip], | ||
81 | is); | 83 | is); |
82 | } | 84 | } |
83 | 85 | ||
@@ -87,20 +89,16 @@ batch_run (void *cls, | |||
87 | * cancel a pending operation thereof. | 89 | * cancel a pending operation thereof. |
88 | * | 90 | * |
89 | * @param cls closure. | 91 | * @param cls closure. |
90 | * @param cmd the command which is being cleaned up. | ||
91 | */ | 92 | */ |
92 | static void | 93 | static void |
93 | batch_cleanup (void *cls, | 94 | batch_cleanup (void *cls) |
94 | const struct GNUNET_TESTING_Command *cmd) | ||
95 | { | 95 | { |
96 | struct BatchState *bs = cls; | 96 | struct BatchState *bs = cls; |
97 | 97 | ||
98 | (void) cmd; | ||
99 | for (unsigned int i = 0; | 98 | for (unsigned int i = 0; |
100 | NULL != bs->batch[i].label; | 99 | NULL != bs->batch[i].label; |
101 | i++) | 100 | i++) |
102 | bs->batch[i].cleanup (bs->batch[i].cls, | 101 | bs->batch[i].cleanup (bs->batch[i].cls); |
103 | &bs->batch[i]); | ||
104 | GNUNET_free (bs->batch); | 102 | GNUNET_free (bs->batch); |
105 | GNUNET_free (bs); | 103 | GNUNET_free (bs); |
106 | } | 104 | } |
@@ -115,7 +113,7 @@ batch_cleanup (void *cls, | |||
115 | * @param index index number of the object to offer. | 113 | * @param index index number of the object to offer. |
116 | * @return #GNUNET_OK on success. | 114 | * @return #GNUNET_OK on success. |
117 | */ | 115 | */ |
118 | static int | 116 | static enum GNUNET_GenericReturnValue |
119 | batch_traits (void *cls, | 117 | batch_traits (void *cls, |
120 | const void **ret, | 118 | const void **ret, |
121 | const char *trait, | 119 | const char *trait, |
@@ -162,7 +160,7 @@ GNUNET_TESTING_cmd_batch (const char *label, | |||
162 | unsigned int i; | 160 | unsigned int i; |
163 | 161 | ||
164 | bs = GNUNET_new (struct BatchState); | 162 | bs = GNUNET_new (struct BatchState); |
165 | 163 | bs->label = label; | |
166 | /* Get number of commands. */ | 164 | /* Get number of commands. */ |
167 | for (i = 0; NULL != batch[i].label; i++) | 165 | for (i = 0; NULL != batch[i].label; i++) |
168 | /* noop */ | 166 | /* noop */ |