mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-22 03:12:22 +00:00
Fri Feb 20 18:25:42 IST 2007 Mark McLoughlin <markmc@redhat.com>
* virsh.c: cmdNetworkList() re-indent this.
This commit is contained in:
parent
1e20b80a91
commit
458344c94e
@ -1,3 +1,7 @@
|
||||
Fri Feb 20 18:25:42 IST 2007 Mark McLoughlin <markmc@redhat.com>
|
||||
|
||||
* virsh.c: cmdNetworkList() re-indent this.
|
||||
|
||||
Fri Feb 20 17:49:22 IST 2007 Mark McLoughlin <markmc@redhat.com>
|
||||
|
||||
Fix a few leaks
|
||||
|
72
src/virsh.c
72
src/virsh.c
@ -1856,44 +1856,44 @@ cmdNetworkList(vshControl * ctl, vshCmd * cmd ATTRIBUTE_UNUSED)
|
||||
return FALSE;
|
||||
|
||||
if (active) {
|
||||
maxactive = virConnectNumOfNetworks(ctl->conn);
|
||||
if (maxactive < 0) {
|
||||
vshError(ctl, FALSE, _("Failed to list active networks"));
|
||||
return FALSE;
|
||||
}
|
||||
if (maxactive) {
|
||||
activeNames = vshMalloc(ctl, sizeof(int) * maxactive);
|
||||
|
||||
if ((maxactive = virConnectListNetworks(ctl->conn, &activeNames[0], maxactive)) < 0) {
|
||||
vshError(ctl, FALSE, _("Failed to list active networks"));
|
||||
free(activeNames);
|
||||
return FALSE;
|
||||
maxactive = virConnectNumOfNetworks(ctl->conn);
|
||||
if (maxactive < 0) {
|
||||
vshError(ctl, FALSE, _("Failed to list active networks"));
|
||||
return FALSE;
|
||||
}
|
||||
if (maxactive) {
|
||||
activeNames = vshMalloc(ctl, sizeof(int) * maxactive);
|
||||
|
||||
qsort(&activeNames[0], maxactive, sizeof(int), namesorter);
|
||||
}
|
||||
if ((maxactive = virConnectListNetworks(ctl->conn, &activeNames[0], maxactive)) < 0) {
|
||||
vshError(ctl, FALSE, _("Failed to list active networks"));
|
||||
free(activeNames);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
qsort(&activeNames[0], maxactive, sizeof(int), namesorter);
|
||||
}
|
||||
}
|
||||
if (inactive) {
|
||||
maxinactive = virConnectNumOfDefinedNetworks(ctl->conn);
|
||||
if (maxinactive < 0) {
|
||||
vshError(ctl, FALSE, _("Failed to list inactive networks"));
|
||||
if (activeNames)
|
||||
free(activeNames);
|
||||
return FALSE;
|
||||
}
|
||||
if (maxinactive) {
|
||||
inactiveNames = vshMalloc(ctl, sizeof(char *) * maxinactive);
|
||||
|
||||
if ((maxinactive = virConnectListDefinedNetworks(ctl->conn, inactiveNames, maxinactive)) < 0) {
|
||||
vshError(ctl, FALSE, _("Failed to list inactive networks"));
|
||||
if (activeNames)
|
||||
free(activeNames);
|
||||
free(inactiveNames);
|
||||
return FALSE;
|
||||
maxinactive = virConnectNumOfDefinedNetworks(ctl->conn);
|
||||
if (maxinactive < 0) {
|
||||
vshError(ctl, FALSE, _("Failed to list inactive networks"));
|
||||
if (activeNames)
|
||||
free(activeNames);
|
||||
return FALSE;
|
||||
}
|
||||
if (maxinactive) {
|
||||
inactiveNames = vshMalloc(ctl, sizeof(char *) * maxinactive);
|
||||
|
||||
qsort(&inactiveNames[0], maxinactive, sizeof(char*), namesorter);
|
||||
}
|
||||
if ((maxinactive = virConnectListDefinedNetworks(ctl->conn, inactiveNames, maxinactive)) < 0) {
|
||||
vshError(ctl, FALSE, _("Failed to list inactive networks"));
|
||||
if (activeNames)
|
||||
free(activeNames);
|
||||
free(inactiveNames);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
qsort(&inactiveNames[0], maxinactive, sizeof(char*), namesorter);
|
||||
}
|
||||
}
|
||||
vshPrintExtra(ctl, "%-20s\n", _("Name"));
|
||||
vshPrintExtra(ctl, "----------------------------------\n");
|
||||
@ -1905,7 +1905,7 @@ cmdNetworkList(vshControl * ctl, vshCmd * cmd ATTRIBUTE_UNUSED)
|
||||
if (!network) {
|
||||
free(activeNames[i]);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
vshPrint(ctl, "%-20s\n",
|
||||
virNetworkGetName(network));
|
||||
@ -1919,10 +1919,10 @@ cmdNetworkList(vshControl * ctl, vshCmd * cmd ATTRIBUTE_UNUSED)
|
||||
if (!network) {
|
||||
free(inactiveNames[i]);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
vshPrint(ctl, "%-20s\n",
|
||||
inactiveNames[i]);
|
||||
vshPrint(ctl, "%-20s\n",
|
||||
inactiveNames[i]);
|
||||
|
||||
virNetworkFree(network);
|
||||
free(inactiveNames[i]);
|
||||
|
Loading…
x
Reference in New Issue
Block a user