[libvirt] [PATCH 2/7] util: Do not assume comma after object id
Han Han
hhan at redhat.com
Tue Jan 7 08:26:48 UTC 2020
On Mon, Jan 6, 2020 at 5:58 PM Peter Krempa <pkrempa at redhat.com> wrote:
> On Wed, Jan 01, 2020 at 13:06:32 +0800, Han Han wrote:
> > From: Han Han <hanhanzhiyeqianke at gmail.com>
> >
> > For qemu object like rng-builtin, there are no properties after id
> > property. We should always set comma after object id. Otherwise it will
> > cause trailing comma on object:
> > -object rng-builtin,id=ID,
> >
> > Signed-off-by: Han Han <hhan at redhat.com>
> > ---
> > src/util/virqemu.c | 13 +++++++------
> > 1 file changed, 7 insertions(+), 6 deletions(-)
> >
> > diff --git a/src/util/virqemu.c b/src/util/virqemu.c
> > index f3a233af..72151e43 100644
> > --- a/src/util/virqemu.c
> > +++ b/src/util/virqemu.c
> > @@ -239,12 +239,13 @@
> virQEMUBuildObjectCommandlineFromJSONInternal(virBufferPtr buf,
> > return -1;
> > }
> >
> > - virBufferAsprintf(buf, "%s,id=%s,", type, alias);
> > -
> > - if (props &&
> > - virQEMUBuildCommandLineJSON(props, buf,
> > -
> virQEMUBuildCommandLineJSONArrayBitmap) < 0)
> > - return -1;
> > + virBufferAsprintf(buf, "%s,id=%s", type, alias);
>
> Keep the newline here.
>
> > + if (props) {
> > + virBufferAsprintf(buf, ",");
>
> Use vir BufferAddLit instead.
>
virBufferAsprintf is for format strings and virBufferAddLit is for const
strings, right?
>
> > + if (virQEMUBuildCommandLineJSON(props, buf,
> > + virQEMUBuildCommandLineJSONArrayBitmap)
> < 0)
> > + return -1;
> > + }
> >
> > return 0;
> > }
> > --
> > 2.23.0
> >
> > --
> > libvir-list mailing list
> > libvir-list at redhat.com
> > https://www.redhat.com/mailman/listinfo/libvir-list
>
>
--
Best regards,
-----------------------------------
Han Han
Quality Engineer
Redhat.
Email: hhan at redhat.com
Phone: +861065339333
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20200107/8e14bd45/attachment-0001.htm>
More information about the libvir-list
mailing list