From 1b0694b79481643cb456d03e1be50a1b4f6ca591 Mon Sep 17 00:00:00 2001 From: Alexander Orzechowski Date: Tue, 3 Oct 2023 01:51:07 -0400 Subject: treewide: Migrate from sizeof(struct) to sizeof(*pointer) where practical --- backend/libinput/backend.c | 3 +-- backend/libinput/events.c | 3 +-- backend/libinput/tablet_pad.c | 3 +-- backend/libinput/tablet_tool.c | 2 +- 4 files changed, 4 insertions(+), 7 deletions(-) (limited to 'backend/libinput') diff --git a/backend/libinput/backend.c b/backend/libinput/backend.c index e95127bd..cbdf8b72 100644 --- a/backend/libinput/backend.c +++ b/backend/libinput/backend.c @@ -194,8 +194,7 @@ static void handle_display_destroy(struct wl_listener *listener, void *data) { struct wlr_backend *wlr_libinput_backend_create(struct wl_display *display, struct wlr_session *session) { - struct wlr_libinput_backend *backend = - calloc(1, sizeof(struct wlr_libinput_backend)); + struct wlr_libinput_backend *backend = calloc(1, sizeof(*backend)); if (!backend) { wlr_log(WLR_ERROR, "Allocation failed: %s", strerror(errno)); return NULL; diff --git a/backend/libinput/events.c b/backend/libinput/events.c index 85724c90..4726e32b 100644 --- a/backend/libinput/events.c +++ b/backend/libinput/events.c @@ -69,8 +69,7 @@ static void handle_device_added(struct wlr_libinput_backend *backend, const char *name = libinput_device_get_name(libinput_dev); wlr_log(WLR_DEBUG, "Adding %s [%d:%d]", name, vendor, product); - struct wlr_libinput_input_device *dev = - calloc(1, sizeof(struct wlr_libinput_input_device)); + struct wlr_libinput_input_device *dev = calloc(1, sizeof(*dev)); if (dev == NULL) { wlr_log_errno(WLR_ERROR, "failed to allocate wlr_libinput_input_device"); return; diff --git a/backend/libinput/tablet_pad.c b/backend/libinput/tablet_pad.c index d72896c0..2e74022a 100644 --- a/backend/libinput/tablet_pad.c +++ b/backend/libinput/tablet_pad.c @@ -22,8 +22,7 @@ static void add_pad_group_from_libinput(struct wlr_tablet_pad *pad, struct libinput_device *device, unsigned int index) { struct libinput_tablet_pad_mode_group *li_group = libinput_device_tablet_pad_get_mode_group(device, index); - struct wlr_tablet_pad_group *group = - calloc(1, sizeof(struct wlr_tablet_pad_group)); + struct wlr_tablet_pad_group *group = calloc(1, sizeof(*group)); if (!group) { wlr_log_errno(WLR_ERROR, "failed to allocate wlr_tablet_pad_group"); return; diff --git a/backend/libinput/tablet_tool.c b/backend/libinput/tablet_tool.c index 1a50f15f..1c85d08b 100644 --- a/backend/libinput/tablet_tool.c +++ b/backend/libinput/tablet_tool.c @@ -92,7 +92,7 @@ static struct tablet_tool *get_tablet_tool( return tool; } - tool = calloc(1, sizeof(struct tablet_tool)); + tool = calloc(1, sizeof(*tool)); if (tool == NULL) { wlr_log_errno(WLR_ERROR, "failed to allocate wlr_libinput_tablet_tool"); return NULL; -- cgit v1.2.3