util: eliminate unnecessary labels

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Laine Stump 2020-07-02 23:20:00 -04:00
parent 6351c85762
commit f3c87f098e
3 changed files with 11 additions and 27 deletions

View File

@ -361,16 +361,12 @@ char *
virQEMUBuildDriveCommandlineFromJSON(virJSONValuePtr srcdef)
{
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
char *ret = NULL;
if (virQEMUBuildCommandLineJSON(srcdef, &buf, NULL, false,
virQEMUBuildCommandLineJSONArrayNumbered) < 0)
goto cleanup;
return NULL;
ret = virBufferContentAndReset(&buf);
cleanup:
return ret;
return virBufferContentAndReset(&buf);
}

View File

@ -1265,16 +1265,15 @@ virSocketAddrPTRDomain(const virSocketAddr *addr,
{
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
size_t i;
int ret = -1;
if (VIR_SOCKET_ADDR_IS_FAMILY(addr, AF_INET)) {
virSocketAddrIPv4 ip;
if (prefix == 0 || prefix >= 32 || prefix % 8 != 0)
goto unsupported;
return -2;
if (virSocketAddrGetIPv4Addr(addr, &ip) < 0)
goto cleanup;
return -1;
for (i = prefix / 8; i > 0; i--)
virBufferAsprintf(&buf, "%u.", ip[i - 1]);
@ -1284,30 +1283,23 @@ virSocketAddrPTRDomain(const virSocketAddr *addr,
virSocketAddrIPv6Nibbles ip;
if (prefix == 0 || prefix >= 128 || prefix % 4 != 0)
goto unsupported;
return -2;
if (virSocketAddrGetIPv6Nibbles(addr, &ip) < 0)
goto cleanup;
return -1;
for (i = prefix / 4; i > 0; i--)
virBufferAsprintf(&buf, "%x.", ip[i - 1]);
virBufferAddLit(&buf, VIR_SOCKET_ADDR_IPV6_ARPA);
} else {
goto unsupported;
return -2;
}
if (!(*ptr = virBufferContentAndReset(&buf)))
goto cleanup;
return -1;
ret = 0;
cleanup:
return ret;
unsupported:
ret = -2;
goto cleanup;
return 0;
}
void

View File

@ -1272,19 +1272,15 @@ int
virXMLValidatorValidate(virXMLValidatorPtr validator,
xmlDocPtr doc)
{
int ret = -1;
if (xmlRelaxNGValidateDoc(validator->rngValid, doc) != 0) {
virReportError(VIR_ERR_XML_INVALID_SCHEMA,
_("Unable to validate doc against %s\n%s"),
validator->schemafile,
virBufferCurrentContent(&validator->buf));
goto cleanup;
return -1;
}
ret = 0;
cleanup:
return ret;
return 0;
}