summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLucas De Marchi <lucas.demarchi@profusion.mobi>2010-08-13 12:53:08 +0000
committerLucas De Marchi <lucas.demarchi@profusion.mobi>2010-08-13 12:53:08 +0000
commit5962d9d66cafa54f08c95fc91d13d5531aef7dd6 (patch)
treed9f85af44befe93a56b063ad2dd917d9e7b2d5b8
parent96d043addc390d108db2f2e9096eac462d421d7a (diff)
downloadimlib2-5962d9d66cafa54f08c95fc91d13d5531aef7dd6.tar.gz
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
-rw-r--r--src/lib/image.c6
-rw-r--r--src/lib/rend.c3
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);