From 5962d9d66cafa54f08c95fc91d13d5531aef7dd6 Mon Sep 17 00:00:00 2001 From: Lucas De Marchi Date: Fri, 13 Aug 2010 12:53:08 +0000 Subject: Apply memset-calloc.cocci Change calls to malloc + memset to calloc whenever an automatic conversion can be done. Possible candidates are not treated here, only the ones we can be sure the conversion is safe. SVN revision: 51078 --- src/lib/image.c | 6 ++---- src/lib/rend.c | 3 +-- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/lib/image.c b/src/lib/image.c index 592e9a4..25c58d3 100644 --- a/src/lib/image.c +++ b/src/lib/image.c @@ -142,8 +142,7 @@ __imlib_ProduceImage(void) { ImlibImage *im; - im = malloc(sizeof(ImlibImage)); - memset(im, 0, sizeof(ImlibImage)); + im = calloc(1, sizeof(ImlibImage)); im->data = NULL; im->file = NULL; im->real_file = NULL; @@ -393,8 +392,7 @@ __imlib_ProduceImagePixmap(void) { ImlibImagePixmap *ip; - ip = malloc(sizeof(ImlibImagePixmap)); - memset(ip, 0, sizeof(ImlibImagePixmap)); + ip = calloc(1, sizeof(ImlibImagePixmap)); ip->display = NULL; ip->visual = NULL; ip->image = NULL; diff --git a/src/lib/rend.c b/src/lib/rend.c index 33f17a2..82139bb 100644 --- a/src/lib/rend.c +++ b/src/lib/rend.c @@ -587,8 +587,7 @@ __imlib_RenderImageSkewed(Display * d, ImlibImage * im, Drawable w, Drawable m, ct = __imlib_GetContext(d, v, cm, depth); back = __imlib_CreateImage(dw, dh, NULL); - back->data = malloc(dw * dh * sizeof(DATA32)); - memset(back->data, 0, dw * dh * sizeof(DATA32)); + back->data = calloc(dw * dh, sizeof(DATA32)); __imlib_GrabDrawableToRGBA(back->data, 0, 0, dw, dh, d, w, 0, v, cm, depth, dx1, dy1, dw, dh, 0, 1); -- cgit v1.2.1