[libvirt PATCH 3/8] tests: qemuxmlconftest: Introduce testQemuConfMarkUsed

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Ján Tomko <jtomko@xxxxxxxxxx>

Make the code readable enough to not need a comment.

Signed-off-by: Ján Tomko <jtomko@xxxxxxxxxx>
---
 tests/qemuxmlconftest.c | 21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)

diff --git a/tests/qemuxmlconftest.c b/tests/qemuxmlconftest.c
index a7e32a5a99..dea75d805f 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.50.1




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux