From: Kristina Hanicova Date: Thu, 23 Sep 2021 23:49:10 +0000 (+0200) Subject: virsh: remove variable 'ret' and 'inactive' X-Git-Tag: v7.8.0-rc1~42 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=45b17385e79805dbd656b76cec505bfb3f1106de;p=thirdparty%2Flibvirt.git virsh: remove variable 'ret' and 'inactive' Signed-off-by: Kristina Hanicova Reviewed-by: Michal Privoznik --- diff --git a/tools/virsh-interface.c b/tools/virsh-interface.c index 4bcc59b580..f402119b68 100644 --- a/tools/virsh-interface.c +++ b/tools/virsh-interface.c @@ -485,26 +485,23 @@ static bool cmdInterfaceDumpXML(vshControl *ctl, const vshCmd *cmd) { virInterfacePtr iface; - bool ret = true; g_autofree char *dump = NULL; unsigned int flags = 0; - bool inactive = vshCommandOptBool(cmd, "inactive"); - if (inactive) + if (vshCommandOptBool(cmd, "inactive")) flags |= VIR_INTERFACE_XML_INACTIVE; if (!(iface = virshCommandOptInterface(ctl, cmd, NULL))) return false; - dump = virInterfaceGetXMLDesc(iface, flags); - if (dump != NULL) { - vshPrint(ctl, "%s", dump); - } else { - ret = false; + if (!(dump = virInterfaceGetXMLDesc(iface, flags))) { + virInterfaceFree(iface); + return false; } + vshPrint(ctl, "%s", dump); virInterfaceFree(iface); - return ret; + return true; } /* diff --git a/tools/virsh-network.c b/tools/virsh-network.c index 198993ac33..1442210278 100644 --- a/tools/virsh-network.c +++ b/tools/virsh-network.c @@ -360,28 +360,23 @@ static bool cmdNetworkDumpXML(vshControl *ctl, const vshCmd *cmd) { virNetworkPtr network; - bool ret = true; g_autofree char *dump = NULL; unsigned int flags = 0; - int inactive; if (!(network = virshCommandOptNetwork(ctl, cmd, NULL))) return false; - inactive = vshCommandOptBool(cmd, "inactive"); - if (inactive) + if (vshCommandOptBool(cmd, "inactive")) flags |= VIR_NETWORK_XML_INACTIVE; - dump = virNetworkGetXMLDesc(network, flags); - - if (dump != NULL) { - vshPrint(ctl, "%s", dump); - } else { - ret = false; + if (!(dump = virNetworkGetXMLDesc(network, flags))) { + virNetworkFree(network); + return false; } + vshPrint(ctl, "%s", dump); virNetworkFree(network); - return ret; + return true; } /*