common: Add znew/znew_n() macros

This commit is contained in:
John Lindgren 2022-09-18 15:22:26 -04:00
parent da57483961
commit a54d378e6c
26 changed files with 47 additions and 47 deletions

View file

@ -202,7 +202,7 @@ new_input_notify(struct wl_listener *listener, void *data)
{
struct seat *seat = wl_container_of(listener, seat, new_input);
struct wlr_input_device *device = data;
struct input *input = xzalloc(sizeof(struct input));
struct input *input = znew(*input);
input->wlr_input_device = device;
input->seat = seat;
@ -263,9 +263,7 @@ new_idle_inhibitor(struct wl_listener *listener, void *data)
struct seat *seat = wl_container_of(listener, seat,
idle_inhibitor_create);
struct idle_inhibitor *inhibitor =
xzalloc(sizeof(struct idle_inhibitor));
struct idle_inhibitor *inhibitor = znew(*inhibitor);
inhibitor->seat = seat;
inhibitor->wlr_inhibitor = wlr_inhibitor;
inhibitor->destroy.notify = destroy_idle_inhibitor;