From c1c66c801514e3c6a1f1242994174cadbc37b5c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Per=20=C3=98yvind=20Karlsen?= Date: Fri, 17 Dec 2010 20:21:48 +0000 Subject: in stead of malloc() & memset() afterwards to zero out memory, just use calloc() right away in stead --- URPM.xs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/URPM.xs b/URPM.xs index d0e0f04..17fbd02 100644 --- a/URPM.xs +++ b/URPM.xs @@ -3910,8 +3910,7 @@ Urpm_stream2header(fp) const char * msg = NULL; rpmRC rc; - pkg = (URPM__Package)malloc(sizeof(struct s_Package)); - memset(pkg, 0, sizeof(struct s_Package)); + pkg = (URPM__Package)calloc(1, sizeof(struct s_Package)); rc = rpmpkgRead(item, fd, &pkg->h, &msg); switch (rc) { @@ -3953,8 +3952,7 @@ Urpm_spec2srcheader(specfile) spec = rpmtsSetSpec(ts, NULL); initSourceHeader(spec, NULL); - pkg = (URPM__Package)malloc(sizeof(struct s_Package)); - memset(pkg, 0, sizeof(struct s_Package)); + pkg = (URPM__Package)calloc(1, sizeof(struct s_Package)); he = (HE_t)memset(alloca(sizeof(*he)), 0, sizeof(*he)); he->tag = RPMTAG_SOURCERPM; -- cgit v1.2.1