Signed-off-by: Laine Stump <laine(a)redhat.com>
---
src/util/virqemu.c | 8 ++------
src/util/virsocketaddr.c | 22 +++++++---------------
src/util/virxml.c | 8 ++------
3 files changed, 11 insertions(+), 27 deletions(-)
diff --git a/src/util/virqemu.c b/src/util/virqemu.c
index 52f3a2ca12..486b8e03db 100644
--- a/src/util/virqemu.c
+++ b/src/util/virqemu.c
@@ -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;
-
- ret = virBufferContentAndReset(&buf);
+ return NULL;
- cleanup:
- return ret;
+ return virBufferContentAndReset(&buf);
}
diff --git a/src/util/virsocketaddr.c b/src/util/virsocketaddr.c
index 0fda8e101b..e0eb76ded3 100644
--- a/src/util/virsocketaddr.c
+++ b/src/util/virsocketaddr.c
@@ -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;
-
- ret = 0;
-
- cleanup:
- return ret;
+ return -1;
- unsupported:
- ret = -2;
- goto cleanup;
+ return 0;
}
void
diff --git a/src/util/virxml.c b/src/util/virxml.c
index 56e6f67597..5558b3829f 100644
--- a/src/util/virxml.c
+++ b/src/util/virxml.c
@@ -1271,19 +1271,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;
}
--
2.25.4