malloc + memset -> zalloc
And for clients using the xmalloc helper, use xzalloc.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
diff --git a/clients/desktop-shell.c b/clients/desktop-shell.c
index 9bd0ade..b17de3a 100644
--- a/clients/desktop-shell.c
+++ b/clients/desktop-shell.c
@@ -409,8 +409,7 @@
return;
}
- clock = xmalloc(sizeof *clock);
- memset(clock, 0, sizeof *clock);
+ clock = xzalloc(sizeof *clock);
clock->panel = panel;
panel->clock = clock;
clock->clock_fd = timerfd;
@@ -512,8 +511,7 @@
struct panel *panel;
struct weston_config_section *s;
- panel = xmalloc(sizeof *panel);
- memset(panel, 0, sizeof *panel);
+ panel = xzalloc(sizeof *panel);
panel->base.configure = panel_configure;
panel->window = window_create_custom(desktop->display);
@@ -582,8 +580,7 @@
char *start, *p, *eq, **ps;
int i, j, k;
- launcher = xmalloc(sizeof *launcher);
- memset(launcher, 0, sizeof *launcher);
+ launcher = xzalloc(sizeof *launcher);
launcher->icon = load_icon_or_fallback(icon);
launcher->path = strdup(path);
@@ -841,8 +838,7 @@
struct display *display = desktop->display;
struct unlock_dialog *dialog;
- dialog = xmalloc(sizeof *dialog);
- memset(dialog, 0, sizeof *dialog);
+ dialog = xzalloc(sizeof *dialog);
dialog->window = window_create_custom(display);
dialog->widget = frame_create(dialog->window, dialog);
@@ -987,9 +983,7 @@
struct weston_config_section *s;
char *type;
- background = xmalloc(sizeof *background);
- memset(background, 0, sizeof *background);
-
+ background = xzalloc(sizeof *background);
background->base.configure = background_configure;
background->window = window_create_custom(desktop->display);
background->widget = window_add_widget(background->window, background);