mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 17:34:18 +03:00
util: Introduce virXMLPropTristateBoolAllowDefault()
We need it for a single scenario in which prop='default' has to be treated as valid input. Signed-off-by: Andrea Bolognani <abologna@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
c49651ac17
commit
fd3ca84c3e
@ -3647,6 +3647,7 @@ virXMLPropEnumDefault;
|
||||
virXMLPropInt;
|
||||
virXMLPropString;
|
||||
virXMLPropTristateBool;
|
||||
virXMLPropTristateBoolAllowDefault;
|
||||
virXMLPropTristateSwitch;
|
||||
virXMLPropUInt;
|
||||
virXMLPropULongLong;
|
||||
|
@ -552,6 +552,24 @@ virXMLPropTristateBool(xmlNodePtr node,
|
||||
}
|
||||
|
||||
|
||||
/* Same as virXMLPropTristateBoolAllowDefault, but will accept the
|
||||
* value 'default' and convert it to VIR_TRISTATE_BOOL_ABSENT instead
|
||||
* of rejecting it with an error. Should only be used for backwards
|
||||
* compatibility reasons, and specifically to parse XML files where a
|
||||
* property having value VIR_TRISTATE_BOOL_ABSENT has historically
|
||||
* resulted in it being formatted with value 'default' instead of
|
||||
* being omitted entirely */
|
||||
int
|
||||
virXMLPropTristateBoolAllowDefault(xmlNodePtr node,
|
||||
const char* name,
|
||||
virXMLPropFlags flags,
|
||||
virTristateBool *result)
|
||||
{
|
||||
return virXMLPropEnumInternal(node, name, virTristateBoolTypeFromString,
|
||||
flags, result, VIR_TRISTATE_BOOL_ABSENT);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* virXMLPropTristateSwitch:
|
||||
* @node: XML dom node pointer
|
||||
|
@ -103,6 +103,13 @@ virXMLPropTristateBool(xmlNodePtr node,
|
||||
virTristateBool *result)
|
||||
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(4);
|
||||
|
||||
int
|
||||
virXMLPropTristateBoolAllowDefault(xmlNodePtr node,
|
||||
const char *name,
|
||||
virXMLPropFlags flags,
|
||||
virTristateBool *result)
|
||||
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(4);
|
||||
|
||||
int
|
||||
virXMLPropTristateSwitch(xmlNodePtr node,
|
||||
const char *name,
|
||||
|
Loading…
Reference in New Issue
Block a user