[libvirt] [PATCH 03/10] tests: qemumonitor: Simplify handling of end of file in full file test

Peter Krempa pkrempa at redhat.com
Fri Jun 8 06:38:48 UTC 2018


On Thu, Jun 07, 2018 at 21:18:30 -0400, John Ferlan wrote:
> 
> 
> On 06/04/2018 09:58 AM, Peter Krempa wrote:
> > On EOF, the loop can be terminated right away since most of it is
> > skipped anyways and the handling of the last command is repeated after
> > the loop.
> > 
> > Signed-off-by: Peter Krempa <pkrempa at redhat.com>
> > ---
> >  tests/qemumonitortestutils.c | 24 +++++++++++-------------
> >  1 file changed, 11 insertions(+), 13 deletions(-)
> > 
> 
> Would this be more readable with virStringSplit[Count] ?  Every time I
> see strchr, that's where I go...
> 
> What's here is fine, but figured I'd ask anyway.

It's not really possible here as the code is removing newlines from the
code until it hits an empty line. We could use virStringSplitCount to
pick the full reply, but AFAIK we'd still need to remove the single
newlines so that the monitor code does not get confused.

> 
> Reviewed-by: John Ferlan <jferlan at redhat.com>
> 
> John
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20180608/633436a3/attachment-0001.sig>


More information about the libvir-list mailing list