[CRIU] [PATCH 02/16] mem/page-pipe: create_page_pipe -- Drop redundant zero assignment

Cyrill Gorcunov gorcunov at gmail.com
Mon Jul 8 15:54:29 MSK 2019


On Mon, Jul 08, 2019 at 03:31:39PM +0300, Mike Rapoport wrote:
> On Fri, Jul 05, 2019 at 06:37:57PM +0300, Cyrill Gorcunov wrote:
> > We allocate with xzalloc, no need for additional zero assignemtns.
> > 
> > Signed-off-by: Cyrill Gorcunov <gorcunov at gmail.com>
> > ---
> >  criu/page-pipe.c | 14 +++-----------
> >  1 file changed, 3 insertions(+), 11 deletions(-)
> > 
> > diff --git a/criu/page-pipe.c b/criu/page-pipe.c
> > index 33741db4224f..32be2f9812e2 100644
> > --- a/criu/page-pipe.c
> > +++ b/criu/page-pipe.c
> > @@ -187,26 +187,18 @@ struct page_pipe *create_page_pipe(unsigned int nr_segs, struct iovec *iovs, uns
> >  	if (!pp)
> >  		return NULL;
> >  
> > +	INIT_LIST_HEAD(&pp->free_bufs);
> > +	INIT_LIST_HEAD(&pp->bufs);
> > +	pp->nr_iovs = nr_segs;
> 
> Why move these before iovs allocation?
> I'd rather only kill zero assignments and keep the rest. Would make the
> diffstat smaller ;-)

Just a habbit. Prefer to have everything init'ed first then proceed :)


More information about the CRIU mailing list