Apply memset-calloc.cocci
authorlucas <lucas@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Fri, 13 Aug 2010 12:53:08 +0000 (12:53 +0000)
committerlucas <lucas@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Fri, 13 Aug 2010 12:53:08 +0000 (12:53 +0000)
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.

git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/evas@51078 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/bin/evas_cserve_main.c
src/lib/engines/common/evas_image_scalecache.c

index 4a6745f..1f30a95 100644 (file)
@@ -1309,13 +1309,12 @@ message(void *fdata, Server *s, Client *c, int opcode, int size, unsigned char *
                   len++;
                }
              DBG("... malloc msg");
-             msg = malloc(len);
+             msg = calloc(1, len);
              if (msg)
                {
                   unsigned char *p;
                   
                   DBG("...   init msg");
-                  memset(msg, 0, len);
                   p = (unsigned char *)msg;
                   msg->active.mem_total = 0;
                   msg->active.count = 0;
index 2830ce5..132d00d 100644 (file)
@@ -265,8 +265,7 @@ _sci_find(RGBA_Image *im,
 
         if (eina_list_count(im->cache.list) > (max_scale_items - 1))
           return NULL;
-        sci = malloc(sizeof(Scaleitem));
-        memset(sci, 0, sizeof(Eina_Inlist));
+        sci = calloc(1, sizeof(Scaleitem));
         sci->parent_im = im;
 #ifdef EVAS_FRAME_QUEUING
         RWLKI(sci->lock);