mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-22 03:12:22 +00:00
ppc64ModelParse: Switch to virXMLPropUInt from virXPathULongHex
We don't need to do the extra XPath lookups and we can use the proper type right away. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
053415a649
commit
5033e5efce
@ -305,7 +305,6 @@ ppc64ModelParse(xmlXPathContextPtr ctxt,
|
||||
g_autoptr(virCPUppc64Model) model = NULL;
|
||||
g_autofree xmlNodePtr *nodes = NULL;
|
||||
g_autofree char *vendor = NULL;
|
||||
unsigned long pvr;
|
||||
size_t i;
|
||||
int n;
|
||||
|
||||
@ -346,23 +345,13 @@ ppc64ModelParse(xmlXPathContextPtr ctxt,
|
||||
model->data.len = n;
|
||||
|
||||
for (i = 0; i < n; i++) {
|
||||
ctxt->node = nodes[i];
|
||||
|
||||
if (virXPathULongHex("string(./@value)", ctxt, &pvr) < 0) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("Missing or invalid PVR value in CPU model %s"),
|
||||
model->name);
|
||||
if (virXMLPropUInt(nodes[i], "value", 16, VIR_XML_PROP_REQUIRED,
|
||||
&model->data.pvr[i].value) < 0)
|
||||
return -1;
|
||||
}
|
||||
model->data.pvr[i].value = pvr;
|
||||
|
||||
if (virXPathULongHex("string(./@mask)", ctxt, &pvr) < 0) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("Missing or invalid PVR mask in CPU model %s"),
|
||||
model->name);
|
||||
if (virXMLPropUInt(nodes[i], "mask", 16, VIR_XML_PROP_REQUIRED,
|
||||
&model->data.pvr[i].mask) < 0)
|
||||
return -1;
|
||||
}
|
||||
model->data.pvr[i].mask = pvr;
|
||||
}
|
||||
|
||||
VIR_APPEND_ELEMENT(map->models, map->nmodels, model);
|
||||
|
Loading…
x
Reference in New Issue
Block a user