[libvirt] [PATCH] virCommand: Cleanup unnecessarily variables

Michal Prívozník mprivozn at redhat.com
Sun May 22 15:00:40 UTC 2011


On 22.05.2011 16:42, Michal Privoznik wrote:
> ---
> 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);

NACK. I misunderstood the concept of VIR_CLOSE. But the problem written
above persists.

Michal




More information about the libvir-list mailing list