virXMLPropTristateBool: Always initialize '@result'

Compilers aren't able to see whether @result is set or not and thus
don't warn of a potential use of uninitialized value. Always set @result
to prevent uninitialized use.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Peter Krempa 2021-05-06 14:35:22 +02:00
parent 46e6542a92
commit bb864e6aa0

View File

@ -600,6 +600,8 @@ virXMLPropEnumInternal(xmlNodePtr node,
* @result: The returned value
*
* Convenience function to return value of a yes / no attribute.
* In case when the property is missing @result is initialized to
* VIR_TRISTATE_BOOL_ABSENT.
*
* Returns 1 in case of success in which case @result is set,
* or 0 if the attribute is not present,
@ -613,6 +615,8 @@ virXMLPropTristateBool(xmlNodePtr node,
{
flags |= VIR_XML_PROP_NONZERO;
*result = VIR_TRISTATE_BOOL_ABSENT;
return virXMLPropEnumInternal(node, name, virTristateBoolTypeFromString,
flags, result);
}