On Wed, Dec 13, 2017 at 05:35:33PM +0000, Stefan Hajnoczi wrote:
> On Tue, Dec 05, 2017 at 01:51:48PM +0800, Peter Xu wrote:
> > A tiny refactoring, preparing to split the QMP dispatcher away.
> > 
> > Reviewed-by: Fam Zheng <f...@redhat.com>
> > Signed-off-by: Peter Xu <pet...@redhat.com>
> > ---
> >  monitor.c | 48 +++++++++++++++++++++++++++++++-----------------
> >  1 file changed, 31 insertions(+), 17 deletions(-)
> > 
> > diff --git a/monitor.c b/monitor.c
> > index 9666115259..35d8925636 100644
> > --- a/monitor.c
> > +++ b/monitor.c
> > @@ -3877,6 +3877,36 @@ static int monitor_can_read(void *opaque)
> >      return (mon->suspend_cnt == 0) ? 1 : 0;
> >  }
> >  
> > +/*
> > + * When rsp/err/id is passed in, the function will be responsible for
> > + * the cleanup.
> > + */
> 
> Please document this function fully.  I had to look at the
> implementation to learn how the arguments work:
> 
> 1. This function takes ownership of rsp, err, and id.  (Please use this
> exact wording because the function does not perform the "cleanup" when
> refcount > 1.)
> 2. rsp, err, and id may be NULL.
> 3. If err != NULL then rsp must be NULL.

Will steal the lines.  Thanks!

Also, I'll add an assert() to make sure (3) is true, in case any rsp
refcount is leaked when accidentally provided with err.

-- 
Peter Xu

Reply via email to