On Fri, Apr 16, 2021 at 14:20:53 +0200, Tim Wiederhake wrote: > Signed-off-by: Tim Wiederhake <twiederh@xxxxxxxxxx> > --- > src/conf/device_conf.c | 33 +++++++++++---------------------- > 1 file changed, 11 insertions(+), 22 deletions(-) > > diff --git a/src/conf/device_conf.c b/src/conf/device_conf.c > index 6a4b14cfda..8d3d012e4a 100644 > --- a/src/conf/device_conf.c > +++ b/src/conf/device_conf.c > @@ -52,32 +52,21 @@ static int > virZPCIDeviceAddressParseXML(xmlNodePtr node, > virPCIDeviceAddress *addr) > { > - virZPCIDeviceAddress def = { .uid = { 0 }, .fid = { 0 } }; > - g_autofree char *uid = NULL; > - g_autofree char *fid = NULL; > + int retUid, retFid; Don't declare 2 variables on a signle line. > > - uid = virXMLPropString(node, "uid"); > - fid = virXMLPropString(node, "fid"); > + if ((retUid = virXMLPropUInt(node, "uid", 0, VIR_XML_PROP_OPTIONAL, > + &addr->zpci.uid.value)) < 0) Second line is misaligned. > + return -1; > > - if (uid) { > - if (virStrToLong_uip(uid, NULL, 0, &def.uid.value) < 0) { > - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", > - _("Cannot parse <address> 'uid' attribute")); > - return -1; > - } > - def.uid.isSet = true; > - } > + if (retUid > 0) > + addr->zpci.uid.isSet = true; > > - if (fid) { > - if (virStrToLong_uip(fid, NULL, 0, &def.fid.value) < 0) { > - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", > - _("Cannot parse <address> 'fid' attribute")); > - return -1; > - } > - def.fid.isSet = true; > - } > + if ((retFid = virXMLPropUInt(node, "fid", 0, VIR_XML_PROP_OPTIONAL, > + &addr->zpci.fid.value)) < 0) Same here. > + return -1; > > - addr->zpci = def; > + if (retFid > 0) > + addr->zpci.fid.isSet = true; > > return 0; > } > -- > 2.26.2 >