mirror of
https://gitlab.freedesktop.org/wayland/wayland.git
synced 2025-11-02 09:01:39 -05:00
Use zalloc instead of malloc + memset
Signed-off-by: Jonas Ådahl <jadahl@gmail.com> Reviewed-by: Daniel Stone <daniels@collabora.com> Reviewed-by: Marek Chalupa <mchqwerty@gmail.com> Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
This commit is contained in:
parent
3de1783e50
commit
2e7fb78682
5 changed files with 15 additions and 18 deletions
|
|
@ -415,11 +415,10 @@ wl_client_create(struct wl_display *display, int fd)
|
|||
struct wl_client *client;
|
||||
socklen_t len;
|
||||
|
||||
client = malloc(sizeof *client);
|
||||
client = zalloc(sizeof *client);
|
||||
if (client == NULL)
|
||||
return NULL;
|
||||
|
||||
memset(client, 0, sizeof *client);
|
||||
client->display = display;
|
||||
client->source = wl_event_loop_add_fd(display->loop, fd,
|
||||
WL_EVENT_READABLE,
|
||||
|
|
@ -854,11 +853,10 @@ wl_socket_alloc(void)
|
|||
{
|
||||
struct wl_socket *s;
|
||||
|
||||
s = malloc(sizeof *s);
|
||||
s = zalloc(sizeof *s);
|
||||
if (!s)
|
||||
return NULL;
|
||||
|
||||
memset(s, 0, sizeof *s);
|
||||
s->fd = -1;
|
||||
s->fd_lock = -1;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue