Remove unneeded labels from the following src/conf files: capabilities.c network_conf.c networkcommon_conf.c nwfilter_conf.c virnetworkobj.c Signed-off-by: Daniel Henrique Barboza <danielhb413@xxxxxxxxx> --- src/conf/capabilities.c | 14 ++++------- src/conf/network_conf.c | 45 +++++++++++++++-------------------- src/conf/networkcommon_conf.c | 11 ++++----- src/conf/nwfilter_conf.c | 3 +-- src/conf/virnetworkobj.c | 7 +++--- 5 files changed, 32 insertions(+), 48 deletions(-) diff --git a/src/conf/capabilities.c b/src/conf/capabilities.c index 82129feaac..9a39858280 100644 --- a/src/conf/capabilities.c +++ b/src/conf/capabilities.c @@ -747,11 +747,11 @@ virCapabilitiesDomainDataLookupInternal(virCapsPtr caps, _("could not find capabilities for %s"), virBufferCurrentContent(&buf)); virBufferFreeAndReset(&buf); - goto error; + return ret; } if (VIR_ALLOC(ret) < 0) - goto error; + return ret; ret->ostype = foundguest->ostype; ret->arch = foundguest->arch.id; @@ -764,7 +764,6 @@ virCapabilitiesDomainDataLookupInternal(virCapsPtr caps, if (foundmachine) ret->machinetype = foundmachine->name; - error: return ret; } @@ -1179,13 +1178,13 @@ virCapabilitiesFormatHostXML(virCapsHostPtr host, if (host->numa && virCapabilitiesHostNUMAFormat(host->numa, buf) < 0) - goto error; + return -1; if (virCapabilitiesFormatCaches(buf, &host->cache) < 0) - goto error; + return -1; if (virCapabilitiesFormatMemoryBandwidth(buf, &host->memBW) < 0) - goto error; + return -1; for (i = 0; i < host->nsecModels; i++) { virBufferAddLit(buf, "<secmodel>\n"); @@ -1207,9 +1206,6 @@ virCapabilitiesFormatHostXML(virCapsHostPtr host, virBufferAddLit(buf, "</host>\n\n"); return 0; - - error: - return -1; } diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c index 5551b5b4d5..27e83b7d85 100644 --- a/src/conf/network_conf.c +++ b/src/conf/network_conf.c @@ -2240,8 +2240,6 @@ static int virNetworkIPDefFormat(virBufferPtr buf, const virNetworkIPDef *def) { - int result = -1; - virBufferAddLit(buf, "<ip"); if (def->family) @@ -2249,14 +2247,14 @@ virNetworkIPDefFormat(virBufferPtr buf, if (VIR_SOCKET_ADDR_VALID(&def->address)) { char *addr = virSocketAddrFormat(&def->address); if (!addr) - goto error; + return -1; virBufferAsprintf(buf, " address='%s'", addr); VIR_FREE(addr); } if (VIR_SOCKET_ADDR_VALID(&def->netmask)) { char *addr = virSocketAddrFormat(&def->netmask); if (!addr) - goto error; + return -1; virBufferAsprintf(buf, " netmask='%s'", addr); VIR_FREE(addr); } @@ -2283,11 +2281,11 @@ virNetworkIPDefFormat(virBufferPtr buf, for (i = 0; i < def->nranges; i++) { char *saddr = virSocketAddrFormat(&def->ranges[i].start); if (!saddr) - goto error; + return -1; char *eaddr = virSocketAddrFormat(&def->ranges[i].end); if (!eaddr) { VIR_FREE(saddr); - goto error; + return -1; } virBufferAsprintf(buf, "<range start='%s' end='%s'/>\n", saddr, eaddr); @@ -2305,7 +2303,7 @@ virNetworkIPDefFormat(virBufferPtr buf, if (VIR_SOCKET_ADDR_VALID(&def->hosts[i].ip)) { char *ipaddr = virSocketAddrFormat(&def->hosts[i].ip); if (!ipaddr) - goto error; + return -1; virBufferAsprintf(buf, " ip='%s'", ipaddr); VIR_FREE(ipaddr); } @@ -2317,7 +2315,7 @@ virNetworkIPDefFormat(virBufferPtr buf, if (VIR_SOCKET_ADDR_VALID(&def->bootserver)) { char *ipaddr = virSocketAddrFormat(&def->bootserver); if (!ipaddr) - goto error; + return -1; virBufferEscapeString(buf, " server='%s'", ipaddr); VIR_FREE(ipaddr); } @@ -2332,9 +2330,7 @@ virNetworkIPDefFormat(virBufferPtr buf, virBufferAdjustIndent(buf, -2); virBufferAddLit(buf, "</ip>\n"); - result = 0; - error: - return result; + return 0; } @@ -2458,7 +2454,7 @@ virNetworkDefFormatBuf(virBufferPtr buf, virBufferGetIndent(buf) / 2, 1) < 0) { xmlBufferFree(xmlbuf); xmlIndentTreeOutput = oldIndentTreeOutput; - goto error; + return -1; } virBufferAsprintf(buf, "%s\n", (char *) xmlBufferContent(xmlbuf)); xmlBufferFree(xmlbuf); @@ -2475,7 +2471,7 @@ virNetworkDefFormatBuf(virBufferPtr buf, virReportError(VIR_ERR_INTERNAL_ERROR, _("Unknown forward type %d in network '%s'"), def->forward.type, def->name); - goto error; + return -1; } virBufferAddLit(buf, "<forward"); virBufferEscapeString(buf, " dev='%s'", dev); @@ -2504,13 +2500,13 @@ virNetworkDefFormatBuf(virBufferPtr buf, virReportError(VIR_ERR_INTERNAL_ERROR, _("unexpected hostdev driver name type %d "), def->forward.driverName); - goto error; + return -1; } virBufferAsprintf(buf, "<driver name='%s'/>\n", driverName); } if (def->forward.type == VIR_NETWORK_FORWARD_NAT) { if (virNetworkForwardNatDefFormat(buf, &def->forward) < 0) - goto error; + return -1; } /* For now, hard-coded to at most 1 forward.pfs */ @@ -2562,7 +2558,7 @@ virNetworkDefFormatBuf(virBufferPtr buf, case VIR_NETWORK_FORWARD_LAST: default: virReportEnumRangeError(virNetworkForwardType, def->forward.type); - goto error; + return -1; } if (hasbridge || def->bridge || def->macTableManager) { @@ -2608,29 +2604,29 @@ virNetworkDefFormatBuf(virBufferPtr buf, } if (virNetworkDNSDefFormat(buf, &def->dns) < 0) - goto error; + return -1; if (virNetDevVlanFormat(&def->vlan, buf) < 0) - goto error; + return -1; if (virNetDevBandwidthFormat(def->bandwidth, 0, buf) < 0) - goto error; + return -1; for (i = 0; i < def->nips; i++) { if (virNetworkIPDefFormat(buf, &def->ips[i]) < 0) - goto error; + return -1; } for (i = 0; i < def->nroutes; i++) { if (virNetDevIPRouteFormat(buf, def->routes[i]) < 0) - goto error; + return -1; } if (virNetDevVPortProfileFormat(def->virtPortProfile, buf) < 0) - goto error; + return -1; for (i = 0; i < def->nPortGroups; i++) if (virPortGroupDefFormat(buf, &def->portGroups[i]) < 0) - goto error; + return -1; if (def->namespaceData && def->ns.format) { if ((def->ns.format)(buf, def->namespaceData) < 0) @@ -2641,9 +2637,6 @@ virNetworkDefFormatBuf(virBufferPtr buf, virBufferAddLit(buf, "</network>\n"); return 0; - - error: - return -1; } diff --git a/src/conf/networkcommon_conf.c b/src/conf/networkcommon_conf.c index de807e2a54..e90cfcbef5 100644 --- a/src/conf/networkcommon_conf.c +++ b/src/conf/networkcommon_conf.c @@ -290,7 +290,6 @@ int virNetDevIPRouteFormat(virBufferPtr buf, const virNetDevIPRoute *def) { - int result = -1; char *addr = NULL; virBufferAddLit(buf, "<route"); @@ -299,13 +298,13 @@ virNetDevIPRouteFormat(virBufferPtr buf, virBufferAsprintf(buf, " family='%s'", def->family); if (!(addr = virSocketAddrFormat(&def->address))) - goto cleanup; + return -1; virBufferAsprintf(buf, " address='%s'", addr); VIR_FREE(addr); if (VIR_SOCKET_ADDR_VALID(&def->netmask)) { if (!(addr = virSocketAddrFormat(&def->netmask))) - goto cleanup; + return -1; virBufferAsprintf(buf, " netmask='%s'", addr); VIR_FREE(addr); } @@ -313,7 +312,7 @@ virNetDevIPRouteFormat(virBufferPtr buf, virBufferAsprintf(buf, " prefix='%u'", def->prefix); if (!(addr = virSocketAddrFormat(&def->gateway))) - goto cleanup; + return -1; virBufferAsprintf(buf, " gateway='%s'", addr); VIR_FREE(addr); @@ -321,7 +320,5 @@ virNetDevIPRouteFormat(virBufferPtr buf, virBufferAsprintf(buf, " metric='%u'", def->metric); virBufferAddLit(buf, "/>\n"); - result = 0; - cleanup: - return result; + return 0; } diff --git a/src/conf/nwfilter_conf.c b/src/conf/nwfilter_conf.c index d071c398bc..680f4184c3 100644 --- a/src/conf/nwfilter_conf.c +++ b/src/conf/nwfilter_conf.c @@ -2903,7 +2903,7 @@ virNWFilterRuleDefDetailsFormat(virBufferPtr buf, _("formatter for %s %s reported error"), type, att[i].name); - goto err_exit; + return; } } else if ((flags & NWFILTER_ENTRY_ITEM_FLAG_HAS_VAR)) { virBufferAddChar(buf, '$'); @@ -2986,7 +2986,6 @@ virNWFilterRuleDefDetailsFormat(virBufferPtr buf, virBufferAsprintf(buf, "<%s/>\n", type); - err_exit: return; } diff --git a/src/conf/virnetworkobj.c b/src/conf/virnetworkobj.c index 5daf4a8cb1..299cdba52d 100644 --- a/src/conf/virnetworkobj.c +++ b/src/conf/virnetworkobj.c @@ -1774,21 +1774,20 @@ virNetworkObjPortListExportCallback(void *payload, if (data->filter && !data->filter(data->net->conn, data->def, def)) - goto cleanup; + return 0; if (!data->ports) { data->nports++; - goto cleanup; + return 0; } if (!(port = virGetNetworkPort(data->net, def->uuid))) { data->error = true; - goto cleanup; + return 0; } data->ports[data->nports++] = port; - cleanup: return 0; } -- 2.24.1 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list