1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2024-12-22 17:34:18 +03:00

Remove some unused variables and cut long lines

* src/virsh.c: a bit of cleanup on previous commit
This commit is contained in:
Daniel Veillard 2009-07-16 22:04:24 +02:00
parent 6b56ac24df
commit 86941f55d5

View File

@ -2772,8 +2772,8 @@ cmdInterfaceEdit (vshControl *ctl, const vshCmd *cmd)
goto cleanup; goto cleanup;
if (STRNEQ (doc, doc_reread)) { if (STRNEQ (doc, doc_reread)) {
vshError (ctl, FALSE, vshError (ctl, FALSE, "%s",
"%s", _("ERROR: the XML configuration was changed by another user")); _("ERROR: the XML configuration was changed by another user"));
goto cleanup; goto cleanup;
} }
@ -2861,8 +2861,11 @@ cmdNetworkList(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
if (maxinactive) { if (maxinactive) {
inactiveNames = vshMalloc(ctl, sizeof(char *) * maxinactive); inactiveNames = vshMalloc(ctl, sizeof(char *) * maxinactive);
if ((maxinactive = virConnectListDefinedNetworks(ctl->conn, inactiveNames, maxinactive)) < 0) { if ((maxinactive =
vshError(ctl, FALSE, "%s", _("Failed to list inactive networks")); virConnectListDefinedNetworks(ctl->conn, inactiveNames,
maxinactive)) < 0) {
vshError(ctl, FALSE, "%s",
_("Failed to list inactive networks"));
free(activeNames); free(activeNames);
free(inactiveNames); free(inactiveNames);
return FALSE; return FALSE;
@ -2871,11 +2874,13 @@ cmdNetworkList(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
qsort(&inactiveNames[0], maxinactive, sizeof(char*), namesorter); qsort(&inactiveNames[0], maxinactive, sizeof(char*), namesorter);
} }
} }
vshPrintExtra(ctl, "%-20s %-10s %s\n", _("Name"), _("State"), _("Autostart")); vshPrintExtra(ctl, "%-20s %-10s %s\n", _("Name"), _("State"),
_("Autostart"));
vshPrintExtra(ctl, "-----------------------------------------\n"); vshPrintExtra(ctl, "-----------------------------------------\n");
for (i = 0; i < maxactive; i++) { for (i = 0; i < maxactive; i++) {
virNetworkPtr network = virNetworkLookupByName(ctl->conn, activeNames[i]); virNetworkPtr network =
virNetworkLookupByName(ctl->conn, activeNames[i]);
const char *autostartStr; const char *autostartStr;
int autostart = 0; int autostart = 0;
@ -3109,7 +3114,8 @@ cmdInterfaceList(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
if ((maxactive = virConnectListInterfaces(ctl->conn, activeNames, if ((maxactive = virConnectListInterfaces(ctl->conn, activeNames,
maxactive)) < 0) { maxactive)) < 0) {
vshError(ctl, FALSE, "%s", _("Failed to list active interfaces")); vshError(ctl, FALSE, "%s",
_("Failed to list active interfaces"));
free(activeNames); free(activeNames);
return FALSE; return FALSE;
} }
@ -3120,15 +3126,19 @@ cmdInterfaceList(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
if (inactive) { if (inactive) {
maxinactive = virConnectNumOfDefinedInterfaces(ctl->conn); maxinactive = virConnectNumOfDefinedInterfaces(ctl->conn);
if (maxinactive < 0) { if (maxinactive < 0) {
vshError(ctl, FALSE, "%s", _("Failed to list inactive interfaces")); vshError(ctl, FALSE, "%s",
_("Failed to list inactive interfaces"));
free(activeNames); free(activeNames);
return FALSE; return FALSE;
} }
if (maxinactive) { if (maxinactive) {
inactiveNames = vshMalloc(ctl, sizeof(char *) * maxinactive); inactiveNames = vshMalloc(ctl, sizeof(char *) * maxinactive);
if ((maxinactive = virConnectListDefinedInterfaces(ctl->conn, inactiveNames, maxinactive)) < 0) { if ((maxinactive =
vshError(ctl, FALSE, "%s", _("Failed to list inactive interfaces")); virConnectListDefinedInterfaces(ctl->conn, inactiveNames,
maxinactive)) < 0) {
vshError(ctl, FALSE, "%s",
_("Failed to list inactive interfaces"));
free(activeNames); free(activeNames);
free(inactiveNames); free(inactiveNames);
return FALSE; return FALSE;
@ -3137,13 +3147,13 @@ cmdInterfaceList(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
qsort(&inactiveNames[0], maxinactive, sizeof(char*), namesorter); qsort(&inactiveNames[0], maxinactive, sizeof(char*), namesorter);
} }
} }
vshPrintExtra(ctl, "%-20s %-10s %s\n", _("Name"), _("State"), _("MAC Address")); vshPrintExtra(ctl, "%-20s %-10s %s\n", _("Name"), _("State"),
_("MAC Address"));
vshPrintExtra(ctl, "--------------------------------------------\n"); vshPrintExtra(ctl, "--------------------------------------------\n");
for (i = 0; i < maxactive; i++) { for (i = 0; i < maxactive; i++) {
virInterfacePtr iface = virInterfaceLookupByName(ctl->conn, activeNames[i]); virInterfacePtr iface =
const char *autostartStr; virInterfaceLookupByName(ctl->conn, activeNames[i]);
int autostart = 0;
/* this kind of work with interfaces is not atomic */ /* this kind of work with interfaces is not atomic */
if (!iface) { if (!iface) {
@ -3159,9 +3169,8 @@ cmdInterfaceList(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
free(activeNames[i]); free(activeNames[i]);
} }
for (i = 0; i < maxinactive; i++) { for (i = 0; i < maxinactive; i++) {
virInterfacePtr iface = virInterfaceLookupByName(ctl->conn, inactiveNames[i]); virInterfacePtr iface =
const char *autostartStr; virInterfaceLookupByName(ctl->conn, inactiveNames[i]);
int autostart = 0;
/* this kind of work with interfaces is not atomic */ /* this kind of work with interfaces is not atomic */
if (!iface) { if (!iface) {