]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
testCompareDomXML2XMLFiles: Sanitize handling of 'parse_flags'
authorPeter Krempa <pkrempa@redhat.com>
Fri, 15 Dec 2023 14:57:50 +0000 (15:57 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Wed, 17 Jan 2024 15:39:06 +0000 (16:39 +0100)
Get rid of the extra temporary variable and set the parse and format
flags based on liveness together.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
tests/testutils.c

index 6ee78cca3c4439690470ce0476be83e549ee8a3a..8d4e7f84bfe8d2331371b2f18c6a418ce08d920f 100644 (file)
@@ -1045,25 +1045,24 @@ int
 testCompareDomXML2XMLFiles(virCaps *caps G_GNUC_UNUSED,
                            virDomainXMLOption *xmlopt,
                            const char *infile, const char *outfile, bool live,
-                           unsigned int parseFlags,
+                           unsigned int parse_flags,
                            testCompareDomXML2XMLResult expectResult)
 {
     g_autofree char *actual = NULL;
     int ret = -1;
     testCompareDomXML2XMLResult result;
     g_autoptr(virDomainDef) def = NULL;
-    unsigned int parse_flags = live ? 0 : VIR_DOMAIN_DEF_PARSE_INACTIVE;
     unsigned int format_flags = VIR_DOMAIN_DEF_FORMAT_SECURE;
 
-    parse_flags |= parseFlags;
-
     if (!virFileExists(infile)) {
         VIR_TEST_DEBUG("Test input file '%s' is missing", infile);
         return -1;
     }
 
-    if (!live)
+    if (!live) {
         format_flags |= VIR_DOMAIN_DEF_FORMAT_INACTIVE;
+        parse_flags |= VIR_DOMAIN_DEF_PARSE_INACTIVE;
+    }
 
     if (!(def = virDomainDefParseFile(infile, xmlopt, NULL, parse_flags))) {
         result = TEST_COMPARE_DOM_XML2XML_RESULT_FAIL_PARSE;