Use [x]zalloc instead of [x]malloc + memset
Signed-off-by: Ryo Munakata <ryomnktml@gmail.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
diff --git a/fullscreen-shell/fullscreen-shell.c b/fullscreen-shell/fullscreen-shell.c
index ef9302b..fa0bf8c 100644
--- a/fullscreen-shell/fullscreen-shell.c
+++ b/fullscreen-shell/fullscreen-shell.c
@@ -142,10 +142,9 @@
struct weston_seat *seat = data;
struct pointer_focus_listener *listener;
- listener = malloc(sizeof *listener);
+ listener = zalloc(sizeof *listener);
if (!listener)
return;
- memset(listener, 0, sizeof *listener);
listener->shell = container_of(l, struct fullscreen_shell,
seat_created_listener);
@@ -251,10 +250,9 @@
{
struct fs_output *fsout;
- fsout = malloc(sizeof *fsout);
+ fsout = zalloc(sizeof *fsout);
if (!fsout)
return NULL;
- memset(fsout, 0, sizeof *fsout);
fsout->shell = shell;
wl_list_insert(&shell->output_list, &fsout->link);
@@ -805,11 +803,10 @@
struct weston_seat *seat;
struct weston_output *output;
- shell = malloc(sizeof *shell);
+ shell = zalloc(sizeof *shell);
if (shell == NULL)
return -1;
- memset(shell, 0, sizeof *shell);
shell->compositor = compositor;
shell->client_destroyed.notify = client_destroyed;