mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-21 20:15:17 +00:00
virPCIDeviceAddressParseXML: Use virXMLNodeGetSubelement to find 'zpci'
Use the helper designed to find the subelement. A slight semantic difference after this patch is that the first <zpci> element will be considered instead of the last, but only one is expected in a valid XML. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com> Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
This commit is contained in:
parent
0f350a4d07
commit
76f7378193
@ -199,8 +199,7 @@ int
|
||||
virPCIDeviceAddressParseXML(xmlNodePtr node,
|
||||
virPCIDeviceAddress *addr)
|
||||
{
|
||||
xmlNodePtr cur;
|
||||
xmlNodePtr zpci = NULL;
|
||||
xmlNodePtr zpci;
|
||||
|
||||
memset(addr, 0, sizeof(*addr));
|
||||
|
||||
@ -227,18 +226,11 @@ virPCIDeviceAddressParseXML(xmlNodePtr node,
|
||||
if (!virPCIDeviceAddressIsEmpty(addr) && !virPCIDeviceAddressIsValid(addr, true))
|
||||
return -1;
|
||||
|
||||
cur = node->children;
|
||||
while (cur) {
|
||||
if (cur->type == XML_ELEMENT_NODE &&
|
||||
virXMLNodeNameEqual(cur, "zpci")) {
|
||||
zpci = cur;
|
||||
}
|
||||
cur = cur->next;
|
||||
if ((zpci = virXMLNodeGetSubelement(node, "zpci"))) {
|
||||
if (virZPCIDeviceAddressParseXML(zpci, addr) < 0)
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (zpci && virZPCIDeviceAddressParseXML(zpci, addr) < 0)
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user