From 95ec72e3386b73b0222fdd92dc624501af41efb3 Mon Sep 17 00:00:00 2001 From: Richard Hansen Date: Tue, 18 Apr 2023 17:49:12 -0400 Subject: tests: Refactor run_commands for readability --- tests/src/test-runner.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/tests/src/test-runner.c b/tests/src/test-runner.c index 1b961961..01e1455e 100644 --- a/tests/src/test-runner.c +++ b/tests/src/test-runner.c @@ -921,23 +921,24 @@ handle_command (const gchar *command) static void run_commands (void) { - /* Stop daemon if requested */ while (TRUE) { - /* Commands start with an asterisk */ ScriptLine *line = get_script_line (NULL); - if (!line || line->text[0] != '*') - break; + if (!line) + { + quit (EXIT_SUCCESS); + return; + } + + /* Commands start with an asterisk */ + if (line->text[0] != '*') + return; statuses = g_list_append (statuses, g_strdup (line->text)); line->done = TRUE; handle_command (line->text + 1); } - - /* Stop at the end of the script */ - if (get_script_line (NULL) == NULL) - quit (EXIT_SUCCESS); } static gboolean -- cgit v1.2.1