mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-18 18:45:16 +00:00
util: xml: Refactor cleanup in virXMLValidateAgainstSchema
Use automatic freeing of the validator context to remove 'ret'/'cleanup:'. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
3e10557766
commit
868ffe3b90
@ -1567,19 +1567,15 @@ int
|
|||||||
virXMLValidateAgainstSchema(const char *schemafile,
|
virXMLValidateAgainstSchema(const char *schemafile,
|
||||||
xmlDocPtr doc)
|
xmlDocPtr doc)
|
||||||
{
|
{
|
||||||
virXMLValidator *validator = NULL;
|
g_autoptr(virXMLValidator) validator = NULL;
|
||||||
int ret = -1;
|
|
||||||
|
|
||||||
if (!(validator = virXMLValidatorInit(schemafile)))
|
if (!(validator = virXMLValidatorInit(schemafile)))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (virXMLValidatorValidate(validator, doc) < 0)
|
if (virXMLValidatorValidate(validator, doc) < 0)
|
||||||
goto cleanup;
|
return -1;
|
||||||
|
|
||||||
ret = 0;
|
return 0;
|
||||||
cleanup:
|
|
||||||
virXMLValidatorFree(validator);
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user