use expressions in sizeof instead of type names

This commit is contained in:
Devin J. Pohly 2020-04-21 14:26:04 -05:00
parent 46ff18413f
commit bf58f7c0d2

9
dwl.c
View File

@ -204,8 +204,7 @@ buttonpress(struct wl_listener *listener, void *data)
void void
createkeyboard(struct wlr_input_device *device) createkeyboard(struct wlr_input_device *device)
{ {
struct dwl_keyboard *keyboard = struct dwl_keyboard *keyboard = calloc(1, sizeof(*keyboard));
calloc(1, sizeof(struct dwl_keyboard));
keyboard->device = device; keyboard->device = device;
/* We need to prepare an XKB keymap and assign it to the keyboard. This /* We need to prepare an XKB keymap and assign it to the keyboard. This
@ -242,8 +241,7 @@ createnotify(struct wl_listener *listener, void *data)
} }
/* Allocate a dwl_view for this surface */ /* Allocate a dwl_view for this surface */
struct dwl_view *view = struct dwl_view *view = calloc(1, sizeof(*view));
calloc(1, sizeof(struct dwl_view));
view->xdg_surface = xdg_surface; view->xdg_surface = xdg_surface;
/* Listen to the various events it can emit */ /* Listen to the various events it can emit */
@ -280,8 +278,7 @@ createoutput(struct wl_listener *listener, void *data)
} }
/* Allocates and configures our state for this output */ /* Allocates and configures our state for this output */
struct dwl_output *output = struct dwl_output *output = calloc(1, sizeof(*output));
calloc(1, sizeof(struct dwl_output));
output->wlr_output = wlr_output; output->wlr_output = wlr_output;
/* Sets up a listener for the frame notify event. */ /* Sets up a listener for the frame notify event. */
output->frame.notify = renderoutput; output->frame.notify = renderoutput;