[libvirt PATCH v2 06/15] network: eliminate unnecessary labels

Ján Tomko jtomko at redhat.com
Wed Jul 15 15:16:12 UTC 2020


On a Tuesday in 2020, Laine Stump wrote:
>All these cleanup/error labels were reduced to having just "return
>ret" by a previous patch, so get rid of them and return directly.
>
>Signed-off-by: Laine Stump <laine at redhat.com>
>---
> src/network/bridge_driver.c       | 264 ++++++++++++------------------
> src/network/bridge_driver_linux.c |  15 +-
> 2 files changed, 113 insertions(+), 166 deletions(-)
>
>@@ -3190,7 +3143,7 @@ static int
> networkFindUnusedBridgeName(virNetworkObjListPtr nets,
>                             virNetworkDefPtr def)
> {
>-    int ret = -1, id = 0;
>+    int id = 0;
>     const char *templ = "virbr%d";
>     const char *p;
>
>@@ -3211,17 +3164,14 @@ networkFindUnusedBridgeName(virNetworkObjListPtr nets,
>               virNetDevExists(newname) == 1)) {
>             VIR_FREE(def->bridge); /*could contain template */
>             def->bridge = g_steal_pointer(&newname);
>-            ret = 0;
>-            goto cleanup;
>+            return 0;
>         }
>     } while (++id <= MAX_BRIDGE_ID);
>
>     virReportError(VIR_ERR_INTERNAL_ERROR,
>                    _("Bridge generation exceeded max id %d"),
>                    MAX_BRIDGE_ID);
>-    ret = 0;
>- cleanup:
>-    return ret;
>+    return -1;

This fix deserves a separate commit. Or at least a mention in the commit
message.

> }
>
>

Reviewed-by: Ján Tomko <jtomko at redhat.com>

Jano
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20200715/401b7ee3/attachment-0001.sig>


More information about the libvir-list mailing list