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 f7fab4ea6b
commit 1c651049c5
3 changed files with 3 additions and 6 deletions

View File

@ -251,8 +251,7 @@ _ecore_config_ipc_init(const char *pipe_name)
ret_srv = NULL;
list = NULL;
list = malloc(sizeof(Ecore_Config_Server));
memset(list, 0, sizeof(Ecore_Config_Server));
list = calloc(1, sizeof(Ecore_Config_Server));
if ((ret = _ecore_config_ipc_ecore_init(pipe_name, &list->server)) != ECORE_CONFIG_ERR_SUCC)
{
ERR("_ecore_config_ipc_init: failed to register %s, code %d",

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

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