[libvirt] [PATCH] virCommand: Cleanup unnecessarily variables

Michal Privoznik mprivozn at redhat.com
Sun May 22 14:42:09 UTC 2011


---
Building with ENABLE_DEBUG=0 showed more errors,
because VIR_DEBUG() get replaced with dummy 'do {} while(0)' statement,
and compiler complains about unused parameters. So if anybody knows
how to get rid of this ... Note that I am speaking about '...' part in
VIR_DEBUG_INT() definition.

 src/util/command.c |    9 +++------
 1 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/src/util/command.c b/src/util/command.c
index ebb90cb..4b8a940 100644
--- a/src/util/command.c
+++ b/src/util/command.c
@@ -962,9 +962,8 @@ virCommandProcessIO(virCommandPtr cmd)
                 } else {
                     inoff += done;
                     if (inoff == inlen) {
-                        int tmpfd = infd;
                         if (VIR_CLOSE(infd) < 0)
-                            VIR_DEBUG("ignoring failed close on fd %d", tmpfd);
+                            VIR_DEBUG("ignoring failed close on fd %d", infd);
                     }
                 }
             }
@@ -1145,17 +1144,15 @@ virCommandRun(virCommandPtr cmd, int *exitstatus)
             VIR_DEBUG("ignoring failed close on fd %d", tmpfd);
     }
     if (cmd->outbuf == &outbuf) {
-        int tmpfd = cmd->outfd;
         if (VIR_CLOSE(cmd->outfd) < 0)
-            VIR_DEBUG("ignoring failed close on fd %d", tmpfd);
+            VIR_DEBUG("ignoring failed close on fd %d", cmd->outfd);
         cmd->outfdptr = NULL;
         cmd->outbuf = NULL;
         VIR_FREE(outbuf);
     }
     if (cmd->errbuf == &errbuf) {
-        int tmpfd = cmd->errfd;
         if (VIR_CLOSE(cmd->errfd) < 0)
-            VIR_DEBUG("ignoring failed close on fd %d", tmpfd);
+            VIR_DEBUG("ignoring failed close on fd %d", cmd->errfd);
         cmd->errfdptr = NULL;
         cmd->errbuf = NULL;
         VIR_FREE(errbuf);
-- 
1.7.5.rc3




More information about the libvir-list mailing list