mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06: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>
|
Fri Feb 20 17:49:22 IST 2007 Mark McLoughlin <markmc@redhat.com>
|
||||||
|
|
||||||
Fix a few leaks
|
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;
|
return FALSE;
|
||||||
|
|
||||||
if (active) {
|
if (active) {
|
||||||
maxactive = virConnectNumOfNetworks(ctl->conn);
|
maxactive = virConnectNumOfNetworks(ctl->conn);
|
||||||
if (maxactive < 0) {
|
if (maxactive < 0) {
|
||||||
vshError(ctl, FALSE, _("Failed to list active networks"));
|
vshError(ctl, FALSE, _("Failed to list active networks"));
|
||||||
return FALSE;
|
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;
|
|
||||||
}
|
}
|
||||||
|
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) {
|
if (inactive) {
|
||||||
maxinactive = virConnectNumOfDefinedNetworks(ctl->conn);
|
maxinactive = virConnectNumOfDefinedNetworks(ctl->conn);
|
||||||
if (maxinactive < 0) {
|
if (maxinactive < 0) {
|
||||||
vshError(ctl, FALSE, _("Failed to list inactive networks"));
|
vshError(ctl, FALSE, _("Failed to list inactive networks"));
|
||||||
if (activeNames)
|
if (activeNames)
|
||||||
free(activeNames);
|
free(activeNames);
|
||||||
return FALSE;
|
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;
|
|
||||||
}
|
}
|
||||||
|
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, "%-20s\n", _("Name"));
|
||||||
vshPrintExtra(ctl, "----------------------------------\n");
|
vshPrintExtra(ctl, "----------------------------------\n");
|
||||||
@ -1905,7 +1905,7 @@ cmdNetworkList(vshControl * ctl, vshCmd * cmd ATTRIBUTE_UNUSED)
|
|||||||
if (!network) {
|
if (!network) {
|
||||||
free(activeNames[i]);
|
free(activeNames[i]);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
vshPrint(ctl, "%-20s\n",
|
vshPrint(ctl, "%-20s\n",
|
||||||
virNetworkGetName(network));
|
virNetworkGetName(network));
|
||||||
@ -1919,10 +1919,10 @@ cmdNetworkList(vshControl * ctl, vshCmd * cmd ATTRIBUTE_UNUSED)
|
|||||||
if (!network) {
|
if (!network) {
|
||||||
free(inactiveNames[i]);
|
free(inactiveNames[i]);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
vshPrint(ctl, "%-20s\n",
|
vshPrint(ctl, "%-20s\n",
|
||||||
inactiveNames[i]);
|
inactiveNames[i]);
|
||||||
|
|
||||||
virNetworkFree(network);
|
virNetworkFree(network);
|
||||||
free(inactiveNames[i]);
|
free(inactiveNames[i]);
|
||||||
|
Loading…
Reference in New Issue
Block a user