xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Wei Liu <wei.liu2@citrix.com>
To: Zhang Chen <zhangchen.fnst@cn.fujitsu.com>
Cc: Anthony PERARD <anthony.perard@citrix.com>,
	Xen devel <xen-devel@lists.xenproject.org>,
	Wei Liu <wei.liu2@citrix.com>,
	Ian Jackson <Ian.Jackson@eu.citrix.com>
Subject: Re: [PATCH] libxl/libxl_qmp.c: Fix code style in qmp_next()
Date: Fri, 23 Dec 2016 11:44:39 +0000	[thread overview]
Message-ID: <20161223114439.GS28690@citrix.com> (raw)
In-Reply-To: <9d180dad-ddf8-0b27-2d90-a8d3dc5da9dc@cn.fujitsu.com>

On Fri, Dec 23, 2016 at 11:16:58AM +0800, Zhang Chen wrote:
[...]
> >>+
> >Here, as I understand it, read can return incomplete message. For
> >example, when the buffer is not big enough.
> >
> >And the inner loop in original code handles that by checking if there is
> >"\r\n". If not, it will read from the socket again.
> >
> >So I'm afraid this patch is not correct. Please point out if there is
> >anything I missed.
> 
> Yes, this patch have some logic error, but I think the code
> looks odd like that:
> "
>         } while (s < s_end);
>    } while (s < s_end);
> "
> 
> The original code use "break" and "continue" to control the double loop
> that make people hard to understand.
> 
> So, Can I change the code without "break" and "continue" like this?

I'm not sure I follow how you would like to change the code.

There is one continue for outer loop and one break for inner loop.

I don't think you can eliminate the continue for outer loop, otherwise
how could you restart the loop?

> "
>         } while (end);
>     } while (s < s_end);
> "

As for this, I think it is buggy, too. It will cause the inner loop to
loop indefinitely.

Wei.

> 
> If yes, I will fix this in next version.
> 
> Thanks
> Zhang Chen
> 
> >Wei.
> >
> >
> >.
> >
> 
> -- 
> Thanks
> Zhang Chen
> 
> 
> 

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

  reply	other threads:[~2016-12-23 11:44 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-22  9:53 [PATCH] libxl/libxl_qmp.c: Fix code style in qmp_next() Zhang Chen
2016-12-22 10:47 ` Wei Liu
2016-12-23  3:16   ` Zhang Chen
2016-12-23 11:44     ` Wei Liu [this message]
2016-12-26  6:48       ` Zhang Chen
2017-01-04 17:56   ` Anthony PERARD

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161223114439.GS28690@citrix.com \
    --to=wei.liu2@citrix.com \
    --cc=Ian.Jackson@eu.citrix.com \
    --cc=anthony.perard@citrix.com \
    --cc=xen-devel@lists.xenproject.org \
    --cc=zhangchen.fnst@cn.fujitsu.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).