]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
tests: qemuxmlconftest: Introduce testQemuConfMarkUsed
authorJán Tomko <jtomko@redhat.com>
Thu, 17 Jul 2025 16:19:44 +0000 (18:19 +0200)
committerJán Tomko <jtomko@redhat.com>
Wed, 24 Sep 2025 13:11:18 +0000 (15:11 +0200)
Make the code readable enough to not need a comment.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
tests/qemuxmlconftest.c

index 04710ec40ef054428e739485a88059ec21751e66..3101f7eef4d650df387962afaebb90fc6912079b 100644 (file)
@@ -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;