conf: ns.parse: decouple call from condition

In the future we will perform more actions if ns.parse
is present. Decouple the condition from the actual call.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
This commit is contained in:
Ján Tomko 2019-08-20 22:12:55 +02:00
parent cf400975f3
commit 94c34cbd66
3 changed files with 12 additions and 9 deletions

View File

@ -21343,9 +21343,10 @@ virDomainDefParseXML(xmlDocPtr xml,
*/
def->ns = xmlopt->ns;
if (def->ns.parse &&
(def->ns.parse)(ctxt, &def->namespaceData) < 0)
goto error;
if (def->ns.parse) {
if ((def->ns.parse)(ctxt, &def->namespaceData) < 0)
goto error;
}
return def;

View File

@ -2050,9 +2050,10 @@ virNetworkDefParseXML(xmlXPathContextPtr ctxt,
if (xmlopt)
def->ns = xmlopt->ns;
if (def->ns.parse &&
(def->ns.parse)(ctxt, &def->namespaceData) < 0)
goto error;
if (def->ns.parse) {
if ((def->ns.parse)(ctxt, &def->namespaceData) < 0)
goto error;
}
ctxt->node = save;
return def;

View File

@ -997,9 +997,10 @@ virStoragePoolDefParseXML(xmlXPathContextPtr ctxt)
/* Make a copy of all the callback pointers here for easier use,
* especially during the virStoragePoolSourceClear method */
def->ns = options->ns;
if (def->ns.parse &&
(def->ns.parse)(ctxt, &def->namespaceData) < 0)
return NULL;
if (def->ns.parse) {
if ((def->ns.parse)(ctxt, &def->namespaceData) < 0)
return NULL;
}
VIR_STEAL_PTR(ret, def);
return ret;