This patch remove the remaining unneeded labels in 'util' files: virnetdev.c virnetdevmacvlan.c virnetdevtap.c virtpm.c virtypedparam.c viruuid.c Signed-off-by: Daniel Henrique Barboza <danielhb413@xxxxxxxxx> --- src/util/virnetdev.c | 13 ++++--------- src/util/virnetdevmacvlan.c | 3 +-- src/util/virnetdevtap.c | 15 ++++++--------- src/util/virtpm.c | 5 ++--- src/util/virtypedparam.c | 14 ++++---------- src/util/viruuid.c | 13 +++++-------- 6 files changed, 22 insertions(+), 41 deletions(-) diff --git a/src/util/virnetdev.c b/src/util/virnetdev.c index 03e276a972..e2aad07c24 100644 --- a/src/util/virnetdev.c +++ b/src/util/virnetdev.c @@ -823,7 +823,6 @@ virNetDevGetRcvAllMulti(const char *ifname, char *virNetDevGetName(int ifindex) { char name[IFNAMSIZ]; - char *ifname = NULL; memset(&name, 0, sizeof(name)); @@ -831,13 +830,10 @@ char *virNetDevGetName(int ifindex) virReportSystemError(errno, _("Failed to convert interface index %d to a name"), ifindex); - goto cleanup; + return NULL; } - ifname = g_strdup(name); - - cleanup: - return ifname; + return g_strdup(name); } #else char *virNetDevGetName(int ifindex) @@ -1702,7 +1698,7 @@ virNetDevParseVfConfig(struct nlattr **tb, int32_t vf, virMacAddrPtr mac, if (!tb[IFLA_VFINFO_LIST]) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("missing IFLA_VF_INFO in netlink response")); - goto cleanup; + return rc; } nla_for_each_nested(tb_vf_info, tb[IFLA_VFINFO_LIST], rem) { @@ -1713,7 +1709,7 @@ virNetDevParseVfConfig(struct nlattr **tb, int32_t vf, virMacAddrPtr mac, ifla_vf_policy)) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("error parsing IFLA_VF_INFO")); - goto cleanup; + return rc; } if (mac && tb[IFLA_VF_MAC]) { @@ -1739,7 +1735,6 @@ virNetDevParseVfConfig(struct nlattr **tb, int32_t vf, virMacAddrPtr mac, virReportError(VIR_ERR_INTERNAL_ERROR, _("couldn't find IFLA_VF_INFO for VF %d " "in netlink response"), vf); - cleanup: return rc; } diff --git a/src/util/virnetdevmacvlan.c b/src/util/virnetdevmacvlan.c index 09efa04df1..3ca568fb44 100644 --- a/src/util/virnetdevmacvlan.c +++ b/src/util/virnetdevmacvlan.c @@ -1156,7 +1156,7 @@ int virNetDevMacVLanRestartWithVPortProfile(const char *cr_ifname, linkdev, vmuuid, virtPortProfile, vmOp); if (rc < 0) - goto error; + return rc; ignore_value(virNetDevVPortProfileAssociate(cr_ifname, virtPortProfile, @@ -1166,7 +1166,6 @@ int virNetDevMacVLanRestartWithVPortProfile(const char *cr_ifname, vmuuid, vmOp, true)); - error: return rc; } diff --git a/src/util/virnetdevtap.c b/src/util/virnetdevtap.c index e3cf44c5cb..6a16b58d60 100644 --- a/src/util/virnetdevtap.c +++ b/src/util/virnetdevtap.c @@ -514,16 +514,16 @@ virNetDevTapAttachBridge(const char *tapname, */ if (mtu > 0) { if (virNetDevSetMTU(tapname, mtu) < 0) - goto error; + return -1; } else { if (virNetDevSetMTUFromDevice(tapname, brname) < 0) - goto error; + return -1; } if (actualMTU) { int retMTU = virNetDevGetMTU(tapname); if (retMTU < 0) - goto error; + return -1; *actualMTU = retMTU; } @@ -532,21 +532,18 @@ virNetDevTapAttachBridge(const char *tapname, if (virtPortProfile) { if (virtPortProfile->virtPortType == VIR_NETDEV_VPORT_PROFILE_MIDONET) { if (virNetDevMidonetBindPort(tapname, virtPortProfile) < 0) - goto error; + return -1; } else if (virtPortProfile->virtPortType == VIR_NETDEV_VPORT_PROFILE_OPENVSWITCH) { if (virNetDevOpenvswitchAddPort(brname, tapname, macaddr, vmuuid, virtPortProfile, virtVlan) < 0) - goto error; + return -1; } } else { if (virNetDevBridgeAddPort(brname, tapname) < 0) - goto error; + return -1; } return 0; - - error: - return -1; } diff --git a/src/util/virtpm.c b/src/util/virtpm.c index 97013f6a7d..505a4230dd 100644 --- a/src/util/virtpm.c +++ b/src/util/virtpm.c @@ -216,16 +216,15 @@ virTPMExecGetCaps(virCommandPtr cmd, continue; if (virBitmapSetBitExpand(bitmap, typ) < 0) - goto cleanup; + return bitmap; } - cleanup: return bitmap; error_bad_json: virReportError(VIR_ERR_INTERNAL_ERROR, _("Unexpected JSON format: %s"), outbuf); - goto cleanup; + return bitmap; } static virBitmapPtr diff --git a/src/util/virtypedparam.c b/src/util/virtypedparam.c index be3dac1571..d6103bdcb6 100644 --- a/src/util/virtypedparam.c +++ b/src/util/virtypedparam.c @@ -327,12 +327,12 @@ virTypedParamsReplaceString(virTypedParameterPtr *params, virReportError(VIR_ERR_INVALID_ARG, _("Parameter '%s' is not a string"), param->field); - goto error; + return -1; } old = param->value.s; } else { if (VIR_EXPAND_N(*params, n, 1) < 0) - goto error; + return -1; param = *params + n - 1; } @@ -342,15 +342,12 @@ virTypedParamsReplaceString(virTypedParameterPtr *params, VIR_TYPED_PARAM_STRING, str) < 0) { param->value.s = old; VIR_FREE(str); - goto error; + return -1; } VIR_FREE(old); *nparams = n; return 0; - - error: - return -1; } @@ -404,7 +401,7 @@ virTypedParamsFilter(virTypedParameterPtr params, size_t i, n = 0; if (VIR_ALLOC_N(*ret, nparams) < 0) - goto error; + return -1; for (i = 0; i < nparams; i++) { if (STREQ(params[i].field, name)) { @@ -414,9 +411,6 @@ virTypedParamsFilter(virTypedParameterPtr params, } return n; - - error: - return -1; } diff --git a/src/util/viruuid.c b/src/util/viruuid.c index 0745189aa9..c8ee59beee 100644 --- a/src/util/viruuid.c +++ b/src/util/viruuid.c @@ -107,20 +107,20 @@ virUUIDParse(const char *uuidstr, unsigned char *uuid) for (i = 0; i < VIR_UUID_BUFLEN;) { uuid[i] = 0; if (*cur == 0) - goto error; + return -1; if ((*cur == '-') || (*cur == ' ')) { cur++; continue; } if (!g_ascii_isxdigit(*cur)) - goto error; + return -1; uuid[i] = virHexToBin(*cur); uuid[i] *= 16; cur++; if (*cur == 0) - goto error; + return -1; if (!g_ascii_isxdigit(*cur)) - goto error; + return -1; uuid[i] += virHexToBin(*cur); i++; cur++; @@ -128,14 +128,11 @@ virUUIDParse(const char *uuidstr, unsigned char *uuid) while (*cur) { if (!g_ascii_isspace(*cur)) - goto error; + return -1; cur++; } return 0; - - error: - return -1; } /** -- 2.24.1 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list