Summary:
In addition to being fewer lines of code,
malloc + memset to 0 is slower than calloc. See
http://stackoverflow.com/questions/2688466/why-mallocmemset-is-slower-than-calloc
Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewers: zmike, cedric, devilhorns
Reviewed By: devilhorns
Subscribers: cedric
Differential Revision: https://phab.enlightenment.org/D2182
ECORE_WL_EVENT_INTERFACES_BOUND = ecore_event_type_new();
}
- if (!(_ecore_wl_disp = malloc(sizeof(Ecore_Wl_Display))))
+ if (!(_ecore_wl_disp = calloc(1, sizeof(Ecore_Wl_Display))))
{
ERR("Could not allocate memory for Ecore_Wl_Display structure");
goto exit_ecore_disp;
}
- memset(_ecore_wl_disp, 0, sizeof(Ecore_Wl_Display));
-
if (!(_ecore_wl_disp->wl.display = wl_display_connect(name)))
{
ERR("Could not connect to Wayland display");
LOGFN(__FILE__, __LINE__, __FUNCTION__);
- if (!(output = malloc(sizeof(Ecore_Wl_Output)))) return;
-
- memset(output, 0, sizeof(Ecore_Wl_Output));
+ if (!(output = calloc(1, sizeof(Ecore_Wl_Output)))) return;
output->display = ewd;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
- if (!(win = malloc(sizeof(Ecore_Wl_Window))))
+ if (!(win = calloc(1, sizeof(Ecore_Wl_Window))))
{
ERR("Failed to allocate an Ecore Wayland Window");
return NULL;
}
- memset(win, 0, sizeof(Ecore_Wl_Window));
-
win->display = _ecore_wl_disp;
win->parent = parent;
win->allocation.x = x;