From 41eea2fe89eb27bb4f97dc4f698d33b85eaa10cd Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A1n=20Tomko?= Date: Thu, 17 Jul 2025 18:19:44 +0200 Subject: [PATCH] tests: qemuxmlconftest: Introduce testQemuConfMarkUsed MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Make the code readable enough to not need a comment. Signed-off-by: Ján Tomko Reviewed-by: Laine Stump --- tests/qemuxmlconftest.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/tests/qemuxmlconftest.c b/tests/qemuxmlconftest.c index 04710ec40e..3101f7eef4 100644 --- a/tests/qemuxmlconftest.c +++ b/tests/qemuxmlconftest.c @@ -598,6 +598,15 @@ testInfoCheckDuplicate(testQemuInfo *info) } +static void +testQemuConfMarkUsed(testQemuInfo *info, + const char *file) +{ + if (file) + ignore_value(g_hash_table_remove(info->conf->existingTestCases, file)); +} + + /** * testQemuConfXMLCommon: Prepare common test data (e.g. parse input XML) * for a test case. @@ -630,14 +639,10 @@ testQemuConfXMLCommon(testQemuInfo *info, if (info->prepared) goto cleanup; - /* mark test case as used */ - ignore_value(g_hash_table_remove(info->conf->existingTestCases, info->infile)); - if (info->outfile) - ignore_value(g_hash_table_remove(info->conf->existingTestCases, info->outfile)); - if (info->errfile) - ignore_value(g_hash_table_remove(info->conf->existingTestCases, info->errfile)); - if (info->out_xml_inactive) - ignore_value(g_hash_table_remove(info->conf->existingTestCases, info->out_xml_inactive)); + testQemuConfMarkUsed(info, info->infile); + testQemuConfMarkUsed(info, info->outfile); + testQemuConfMarkUsed(info, info->errfile); + testQemuConfMarkUsed(info, info->out_xml_inactive); if (testQemuInfoInitArgs((testQemuInfo *) info) < 0) goto cleanup; -- 2.47.3