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

Cyrill Gorcunov gorcunov at gmail.com
Fri Jul 5 18:37:57 MSK 2019


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;
 	pp->flags = flags;
 
 	if (!iovs) {
 		iovs = xmalloc(sizeof(*iovs) * nr_segs);
 		if (!iovs)
 			goto err_free_pp;
-
 		pp->flags |= PP_OWN_IOVS;
 	}
-
-	pp->nr_pipes = 0;
-	INIT_LIST_HEAD(&pp->bufs);
-	INIT_LIST_HEAD(&pp->free_bufs);
-	pp->nr_iovs = nr_segs;
 	pp->iovs = iovs;
-	pp->free_iov = 0;
-
-	pp->nr_holes = 0;
-	pp->free_hole = 0;
-	pp->holes = NULL;
 
 	if (page_pipe_grow(pp, 0))
 		goto err_free_iovs;
-- 
2.20.1



More information about the CRIU mailing list