1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-01-13 17:18:01 +03:00

virDomainTimerDef: Convert 'name' field to proper enum type

Adjust the type and the corresponding parser to use virXMLPropEnum.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Peter Krempa 2022-10-24 14:58:39 +02:00
parent a9a2ecec54
commit 7fc2c87200
2 changed files with 3 additions and 12 deletions

View File

@ -10546,24 +10546,15 @@ virDomainTimerDefParseXML(xmlNodePtr node,
VIR_XPATH_NODE_AUTORESTORE(ctxt) VIR_XPATH_NODE_AUTORESTORE(ctxt)
xmlNodePtr catchup; xmlNodePtr catchup;
int ret; int ret;
g_autofree char *name = NULL;
g_autofree char *tickpolicy = NULL; g_autofree char *tickpolicy = NULL;
g_autofree char *track = NULL; g_autofree char *track = NULL;
g_autofree char *mode = NULL; g_autofree char *mode = NULL;
ctxt->node = node; ctxt->node = node;
name = virXMLPropString(node, "name"); if (virXMLPropEnum(node, "name", virDomainTimerNameTypeFromString,
if (name == NULL) { VIR_XML_PROP_REQUIRED, &def->name) < 0)
virReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("missing timer name"));
return NULL; return NULL;
}
if ((def->name = virDomainTimerNameTypeFromString(name)) < 0) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("unknown timer name '%s'"), name);
return NULL;
}
if (virXMLPropTristateBool(node, "present", if (virXMLPropTristateBool(node, "present",
VIR_XML_PROP_NONE, VIR_XML_PROP_NONE,

View File

@ -2472,7 +2472,7 @@ struct _virDomainTimerCatchupDef {
}; };
struct _virDomainTimerDef { struct _virDomainTimerDef {
int name; virDomainTimerNameType name;
virTristateBool present; virTristateBool present;
int tickpolicy; /* enum virDomainTimerTickpolicyType */ int tickpolicy; /* enum virDomainTimerTickpolicyType */