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
This commit is contained in:
Lucas De Marchi 2010-08-13 12:53:08 +00:00
parent 96d043addc
commit 5962d9d66c
2 changed files with 3 additions and 6 deletions

View File

@ -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;

View File

@ -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);