mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-22 04:25:18 +00:00
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:
parent
6351c85762
commit
f3c87f098e
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user