[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH] libxl/libxl_qmp.c: Fix code style in qmp_next()



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@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.