[libvirt] [PATCH v3 3/4] qemu: remove pointless condition

Martin Kletzander mkletzan at redhat.com
Tue Feb 11 12:38:23 UTC 2014


On Tue, Feb 11, 2014 at 12:13:43PM +0100, Christophe Fergeau wrote:
> On Mon, Feb 10, 2014 at 03:03:06PM +0100, Martin Kletzander wrote:
> > This patch is here just to ease the code review and make related
> > changes look more sensible.
>
> Hehe this description actually made things not as easy as they could have
> ;)
> I would have specifically mentioned that if (def->nserials) is removed and
> that the rest of the patch is just whitespace changes (output of git show
> -w could even have been added to the log).
>

Oh, '-w' is the magic one, I could've used that, I also wanted to use
'-C -C' for the next patch, but _somehow_ failed to do that.  Will do
next time, sorry.

Martin

> Christophe
>
> >
> > Signed-off-by: Martin Kletzander <mkletzan at redhat.com>
> > ---
> >  src/qemu/qemu_command.c | 44 +++++++++++++++++++++-----------------------
> >  1 file changed, 21 insertions(+), 23 deletions(-)
> >
> > diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
> > index d8a7951..6ff9fd5 100644
> > --- a/src/qemu/qemu_command.c
> > +++ b/src/qemu/qemu_command.c
> > @@ -8803,32 +8803,30 @@ qemuBuildCommandLine(virConnectPtr conn,
> >          virCommandAddArgBuffer(cmd, &opt);
> >      }
> >
> > -    if (def->nserials) {
> > -        for (i = 0; i < def->nserials; i++) {
> > -            virDomainChrDefPtr serial = def->serials[i];
> > -            char *devstr;
> > +    for (i = 0; i < def->nserials; i++) {
> > +        virDomainChrDefPtr serial = def->serials[i];
> > +        char *devstr;
> >
> > -            /* Use -chardev with -device if they are available */
> > -            if (virQEMUCapsSupportsChardev(def, qemuCaps, serial)) {
> > -                virCommandAddArg(cmd, "-chardev");
> > -                if (!(devstr = qemuBuildChrChardevStr(&serial->source,
> > -                                                      serial->info.alias,
> > -                                                      qemuCaps)))
> > -                    goto error;
> > -                virCommandAddArg(cmd, devstr);
> > -                VIR_FREE(devstr);
> > +        /* Use -chardev with -device if they are available */
> > +        if (virQEMUCapsSupportsChardev(def, qemuCaps, serial)) {
> > +            virCommandAddArg(cmd, "-chardev");
> > +            if (!(devstr = qemuBuildChrChardevStr(&serial->source,
> > +                                                  serial->info.alias,
> > +                                                  qemuCaps)))
> > +                goto error;
> > +            virCommandAddArg(cmd, devstr);
> > +            VIR_FREE(devstr);
> >
> > -                if (qemuBuildChrDeviceCommandLine(cmd, def, serial, qemuCaps) < 0)
> > -                   goto error;
> > -            } else {
> > -                virCommandAddArg(cmd, "-serial");
> > -                if (!(devstr = qemuBuildChrArgStr(&serial->source, NULL)))
> > -                    goto error;
> > -                virCommandAddArg(cmd, devstr);
> > -                VIR_FREE(devstr);
> > -            }
> > -            actualSerials++;
> > +            if (qemuBuildChrDeviceCommandLine(cmd, def, serial, qemuCaps) < 0)
> > +                goto error;
> > +        } else {
> > +            virCommandAddArg(cmd, "-serial");
> > +            if (!(devstr = qemuBuildChrArgStr(&serial->source, NULL)))
> > +                goto error;
> > +            virCommandAddArg(cmd, devstr);
> > +            VIR_FREE(devstr);
> >          }
> > +        actualSerials++;
> >      }
> >
> >      /* If we have -device, then we set -nodefault already */
> > --
> > 1.8.5.4
> >
> > --
> > libvir-list mailing list
> > libvir-list at redhat.com
> > https://www.redhat.com/mailman/listinfo/libvir-list
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20140211/a04f434e/attachment-0001.sig>


More information about the libvir-list mailing list