virsh: remove variable 'ret' and 'inactive'

Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Kristina Hanicova 2021-09-24 01:49:10 +02:00 committed by Michal Privoznik
parent 409ccebcaa
commit 45b17385e7
2 changed files with 12 additions and 20 deletions

View File

@ -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;
}
/*

View File

@ -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;
}
/*