From c132968605dd3e824765e4c1154840f9659a3e70 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Tue, 15 Aug 2023 20:27:00 +0200 Subject: assert run is non-null for most cmds, except end --- src/testing/testing_api_loop.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'src/testing/testing_api_loop.c') diff --git a/src/testing/testing_api_loop.c b/src/testing/testing_api_loop.c index f53e1ecdb..0110f2cc9 100644 --- a/src/testing/testing_api_loop.c +++ b/src/testing/testing_api_loop.c @@ -611,12 +611,24 @@ GNUNET_TESTING_command_new (void *cls, .cleanup = cleanup, .traits = traits }; - memset (&cmd.label, 0, sizeof (cmd.label)); - if (NULL != label) - strncpy (cmd.label, label, GNUNET_TESTING_CMD_MAX_LABEL_LENGTH); + GNUNET_assert (NULL != run); + if (NULL != label) + strncpy (cmd.label, + label, + GNUNET_TESTING_CMD_MAX_LABEL_LENGTH); return cmd; +} + + +struct GNUNET_TESTING_Command +GNUNET_TESTING_cmd_end (void) +{ + struct GNUNET_TESTING_Command cmd = { + .run = NULL + }; + return cmd; } -- cgit v1.2.3