[libvirt PATCH 7/8] tools: remove unread variables

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Some of libvirt APIs return the number of elements, but we
don't need them, only whether the API failed or not.

Delete the redundant variables.

Signed-off-by: Ján Tomko <jtomko@xxxxxxxxxx>
---
 tools/virsh-domain.c | 7 +++----
 tools/virt-admin.c   | 9 +++------
 2 files changed, 6 insertions(+), 10 deletions(-)

diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index aaf3b9a6a5..97d6427638 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -6886,7 +6886,6 @@ virshVcpuinfoInactive(vshControl *ctl,
 {
     g_autofree unsigned char *cpumaps = NULL;
     size_t cpumaplen;
-    int ncpus;
     g_autoptr(virBitmap) vcpus = NULL;
     ssize_t nextvcpu = -1;
     bool first = true;
@@ -6897,9 +6896,9 @@ virshVcpuinfoInactive(vshControl *ctl,
     cpumaplen = VIR_CPU_MAPLEN(maxcpu);
     cpumaps = vshMalloc(ctl, virBitmapSize(vcpus) * cpumaplen);
 
-    if ((ncpus = virDomainGetVcpuPinInfo(dom, virBitmapSize(vcpus),
-                                         cpumaps, cpumaplen,
-                                         VIR_DOMAIN_AFFECT_CONFIG)) < 0)
+    if (virDomainGetVcpuPinInfo(dom, virBitmapSize(vcpus),
+                                cpumaps, cpumaplen,
+                                VIR_DOMAIN_AFFECT_CONFIG) < 0)
         return false;
 
     while ((nextvcpu = virBitmapNextSetBit(vcpus, nextvcpu)) >= 0) {
diff --git a/tools/virt-admin.c b/tools/virt-admin.c
index fef0332a0d..4856758b4e 100644
--- a/tools/virt-admin.c
+++ b/tools/virt-admin.c
@@ -1040,7 +1040,6 @@ static const vshCmdOptDef opts_daemon_log_filters[] = {
 static bool
 cmdDaemonLogFilters(vshControl *ctl, const vshCmd *cmd)
 {
-    int nfilters;
     char *filters = NULL;
     vshAdmControlPtr priv = ctl->privData;
 
@@ -1052,8 +1051,8 @@ cmdDaemonLogFilters(vshControl *ctl, const vshCmd *cmd)
             return false;
         }
     } else {
-        if ((nfilters = virAdmConnectGetLoggingFilters(priv->conn,
-                                                       &filters, 0)) < 0) {
+        if (virAdmConnectGetLoggingFilters(priv->conn,
+                                           &filters, 0) < 0) {
             vshError(ctl, _("Unable to get daemon logging filters information"));
             return false;
         }
@@ -1094,7 +1093,6 @@ static const vshCmdOptDef opts_daemon_log_outputs[] = {
 static bool
 cmdDaemonLogOutputs(vshControl *ctl, const vshCmd *cmd)
 {
-    int noutputs;
     char *outputs = NULL;
     vshAdmControlPtr priv = ctl->privData;
 
@@ -1106,8 +1104,7 @@ cmdDaemonLogOutputs(vshControl *ctl, const vshCmd *cmd)
             return false;
         }
     } else {
-        if ((noutputs = virAdmConnectGetLoggingOutputs(priv->conn,
-                                                       &outputs, 0)) < 0) {
+        if (virAdmConnectGetLoggingOutputs(priv->conn, &outputs, 0) < 0) {
             vshError(ctl, _("Unable to get daemon logging outputs information"));
             return false;
         }
-- 
2.26.2




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux