Signed-off-by: Tim Wiederhake <twiederh@xxxxxxxxxx> --- src/conf/domain_conf.c | 25 +++++-------------------- 1 file changed, 5 insertions(+), 20 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 0b5d8e5164..6b98d34eb4 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -14211,8 +14211,6 @@ virDomainMemballoonDefParseXML(virDomainXMLOptionPtr xmlopt, VIR_XPATH_NODE_AUTORESTORE(ctxt) unsigned int period = 0; g_autofree char *model = NULL; - g_autofree char *freepage_reporting = NULL; - g_autofree char *deflate = NULL; def = g_new0(virDomainMemballoonDef, 1); @@ -14229,25 +14227,12 @@ virDomainMemballoonDefParseXML(virDomainXMLOptionPtr xmlopt, goto error; } - if ((deflate = virXMLPropString(node, "autodeflate"))) { - int value; - if ((value = virTristateSwitchTypeFromString(deflate)) <= 0) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("invalid autodeflate attribute value '%s'"), deflate); - goto error; - } - def->autodeflate = value; - } + if (virXMLPropTristateSwitch(node, "autodeflate", false, &def->autodeflate) < 0) + goto error; - if ((freepage_reporting = virXMLPropString(node, "freePageReporting"))) { - int value; - if ((value = virTristateSwitchTypeFromString(freepage_reporting)) <= 0) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("invalid freePageReporting attribute value '%s'"), freepage_reporting); - goto error; - } - def->free_page_reporting = value; - } + if (virXMLPropTristateSwitch(node, "freePageReporting", false, + &def->free_page_reporting) < 0) + goto error; ctxt->node = node; if (virXPathUInt("string(./stats/@period)", ctxt, &period) < -1) { -- 2.26.2