aboutsummaryrefslogtreecommitdiff
path: root/backend
diff options
context:
space:
mode:
authorAlexander Orzechowski <alex@ozal.ski>2023-10-03 01:51:07 -0400
committerAlexander Orzechowski <alex@ozal.ski>2023-10-03 01:51:07 -0400
commit1b0694b79481643cb456d03e1be50a1b4f6ca591 (patch)
treec693c5de3ee7ebd52873f6ec063118408f0bd28a /backend
parenta09d6494397bdd28a3254d2e646212afb5a3049c (diff)
treewide: Migrate from sizeof(struct) to sizeof(*pointer) where practical
Diffstat (limited to 'backend')
-rw-r--r--backend/drm/atomic.c4
-rw-r--r--backend/drm/backend.c2
-rw-r--r--backend/drm/monitor.c3
-rw-r--r--backend/headless/backend.c3
-rw-r--r--backend/headless/output.c3
-rw-r--r--backend/libinput/backend.c3
-rw-r--r--backend/libinput/events.c3
-rw-r--r--backend/libinput/tablet_pad.c3
-rw-r--r--backend/libinput/tablet_tool.c2
-rw-r--r--backend/multi/backend.c5
-rw-r--r--backend/wayland/backend.c2
-rw-r--r--backend/wayland/output.c2
-rw-r--r--backend/wayland/pointer.c2
-rw-r--r--backend/wayland/seat.c2
-rw-r--r--backend/wayland/tablet_v2.c11
-rw-r--r--backend/x11/input_device.c2
-rw-r--r--backend/x11/output.c4
17 files changed, 23 insertions, 33 deletions
diff --git a/backend/drm/atomic.c b/backend/drm/atomic.c
index c2005f96..4715c6f0 100644
--- a/backend/drm/atomic.c
+++ b/backend/drm/atomic.c
@@ -117,7 +117,7 @@ bool create_gamma_lut_blob(struct wlr_drm_backend *drm,
return true;
}
- struct drm_color_lut *gamma = malloc(size * sizeof(struct drm_color_lut));
+ struct drm_color_lut *gamma = malloc(size * sizeof(*gamma));
if (gamma == NULL) {
wlr_log(WLR_ERROR, "Failed to allocate gamma table");
return false;
@@ -133,7 +133,7 @@ bool create_gamma_lut_blob(struct wlr_drm_backend *drm,
}
if (drmModeCreatePropertyBlob(drm->fd, gamma,
- size * sizeof(struct drm_color_lut), blob_id) != 0) {
+ size * sizeof(*gamma), blob_id) != 0) {
wlr_log_errno(WLR_ERROR, "Unable to create gamma LUT property blob");
free(gamma);
return false;
diff --git a/backend/drm/backend.c b/backend/drm/backend.c
index 244a2df1..df02c6b3 100644
--- a/backend/drm/backend.c
+++ b/backend/drm/backend.c
@@ -202,7 +202,7 @@ struct wlr_backend *wlr_drm_backend_create(struct wl_display *display,
wlr_log(WLR_INFO, "Initializing DRM backend for %s (%s)", name, version->name);
drmFreeVersion(version);
- struct wlr_drm_backend *drm = calloc(1, sizeof(struct wlr_drm_backend));
+ struct wlr_drm_backend *drm = calloc(1, sizeof(*drm));
if (!drm) {
wlr_log_errno(WLR_ERROR, "Allocation failed");
return NULL;
diff --git a/backend/drm/monitor.c b/backend/drm/monitor.c
index 539e7925..4b1eeaa9 100644
--- a/backend/drm/monitor.c
+++ b/backend/drm/monitor.c
@@ -67,8 +67,7 @@ struct wlr_drm_backend_monitor *drm_backend_monitor_create(
struct wlr_backend *multi,
struct wlr_backend *primary_drm,
struct wlr_session *session) {
- struct wlr_drm_backend_monitor *monitor =
- calloc(1, sizeof(struct wlr_drm_backend_monitor));
+ struct wlr_drm_backend_monitor *monitor = calloc(1, sizeof(*monitor));
if (!monitor) {
wlr_log_errno(WLR_ERROR, "Allocation failed");
return NULL;
diff --git a/backend/headless/backend.c b/backend/headless/backend.c
index f0cde0c7..8ab7d039 100644
--- a/backend/headless/backend.c
+++ b/backend/headless/backend.c
@@ -66,8 +66,7 @@ static void handle_display_destroy(struct wl_listener *listener, void *data) {
struct wlr_backend *wlr_headless_backend_create(struct wl_display *display) {
wlr_log(WLR_INFO, "Creating headless backend");
- struct wlr_headless_backend *backend =
- calloc(1, sizeof(struct wlr_headless_backend));
+ struct wlr_headless_backend *backend = calloc(1, sizeof(*backend));
if (!backend) {
wlr_log(WLR_ERROR, "Failed to allocate wlr_headless_backend");
return NULL;
diff --git a/backend/headless/output.c b/backend/headless/output.c
index a6c97dec..406959b4 100644
--- a/backend/headless/output.c
+++ b/backend/headless/output.c
@@ -107,8 +107,7 @@ struct wlr_output *wlr_headless_add_output(struct wlr_backend *wlr_backend,
struct wlr_headless_backend *backend =
headless_backend_from_backend(wlr_backend);
- struct wlr_headless_output *output =
- calloc(1, sizeof(struct wlr_headless_output));
+ struct wlr_headless_output *output = calloc(1, sizeof(*output));
if (output == NULL) {
wlr_log(WLR_ERROR, "Failed to allocate wlr_headless_output");
return NULL;
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;
diff --git a/backend/multi/backend.c b/backend/multi/backend.c
index 1ee21c14..fccad5b4 100644
--- a/backend/multi/backend.c
+++ b/backend/multi/backend.c
@@ -127,8 +127,7 @@ static void handle_display_destroy(struct wl_listener *listener, void *data) {
}
struct wlr_backend *wlr_multi_backend_create(struct wl_display *display) {
- struct wlr_multi_backend *backend =
- calloc(1, sizeof(struct wlr_multi_backend));
+ struct wlr_multi_backend *backend = calloc(1, sizeof(*backend));
if (!backend) {
wlr_log(WLR_ERROR, "Backend allocation failed");
return NULL;
@@ -191,7 +190,7 @@ bool wlr_multi_backend_add(struct wlr_backend *_multi,
return true;
}
- struct subbackend_state *sub = calloc(1, sizeof(struct subbackend_state));
+ struct subbackend_state *sub = calloc(1, sizeof(*sub));
if (sub == NULL) {
wlr_log(WLR_ERROR, "Could not add backend: allocation failed");
return false;
diff --git a/backend/wayland/backend.c b/backend/wayland/backend.c
index ba67b2bf..e8d06eba 100644
--- a/backend/wayland/backend.c
+++ b/backend/wayland/backend.c
@@ -257,7 +257,7 @@ static char *get_render_name(const char *name) {
wlr_log(WLR_ERROR, "drmGetDevices2 failed: %s", strerror(-devices_len));
return NULL;
}
- drmDevice **devices = calloc(devices_len, sizeof(drmDevice *));
+ drmDevice **devices = calloc(devices_len, sizeof(*devices));
if (devices == NULL) {
wlr_log_errno(WLR_ERROR, "Allocation failed");
return NULL;
diff --git a/backend/wayland/output.c b/backend/wayland/output.c
index 2e5c39f5..ab6e3eef 100644
--- a/backend/wayland/output.c
+++ b/backend/wayland/output.c
@@ -230,7 +230,7 @@ static struct wlr_wl_buffer *create_wl_buffer(struct wlr_wl_backend *wl,
return NULL;
}
- struct wlr_wl_buffer *buffer = calloc(1, sizeof(struct wlr_wl_buffer));
+ struct wlr_wl_buffer *buffer = calloc(1, sizeof(*buffer));
if (buffer == NULL) {
wl_buffer_destroy(wl_buffer);
return NULL;
diff --git a/backend/wayland/pointer.c b/backend/wayland/pointer.c
index 00f3254c..39fb337e 100644
--- a/backend/wayland/pointer.c
+++ b/backend/wayland/pointer.c
@@ -448,7 +448,7 @@ void create_pointer(struct wlr_wl_seat *seat, struct wlr_wl_output *output) {
wlr_log(WLR_DEBUG, "creating pointer for output '%s' from seat '%s'",
output->wlr_output.name, seat->name);
- struct wlr_wl_pointer *pointer = calloc(1, sizeof(struct wlr_wl_pointer));
+ struct wlr_wl_pointer *pointer = calloc(1, sizeof(*pointer));
if (pointer == NULL) {
wlr_log(WLR_ERROR, "failed to allocate wlr_wl_pointer");
return;
diff --git a/backend/wayland/seat.c b/backend/wayland/seat.c
index 46c6958b..d88a370f 100644
--- a/backend/wayland/seat.c
+++ b/backend/wayland/seat.c
@@ -266,7 +266,7 @@ static const struct wl_seat_listener seat_listener;
bool create_wl_seat(struct wl_seat *wl_seat, struct wlr_wl_backend *wl,
uint32_t global_name) {
- struct wlr_wl_seat *seat = calloc(1, sizeof(struct wlr_wl_seat));
+ struct wlr_wl_seat *seat = calloc(1, sizeof(*seat));
if (!seat) {
wlr_log_errno(WLR_ERROR, "Allocation failed");
return false;
diff --git a/backend/wayland/tablet_v2.c b/backend/wayland/tablet_v2.c
index 357c74c6..a3604b51 100644
--- a/backend/wayland/tablet_v2.c
+++ b/backend/wayland/tablet_v2.c
@@ -206,8 +206,7 @@ static void handle_tablet_pad_group_ring(void *data,
struct zwp_tablet_pad_group_v2 *pad_group,
struct zwp_tablet_pad_ring_v2 *ring) {
struct tablet_pad_group *group = data;
- struct tablet_pad_ring *tablet_ring =
- calloc(1, sizeof(struct tablet_pad_ring));
+ struct tablet_pad_ring *tablet_ring = calloc(1, sizeof(*tablet_ring));
if (!tablet_ring) {
zwp_tablet_pad_ring_v2_destroy(ring);
return;
@@ -227,8 +226,7 @@ static void handle_tablet_pad_group_strip(void *data,
struct zwp_tablet_pad_group_v2 *pad_group,
struct zwp_tablet_pad_strip_v2 *strip) {
struct tablet_pad_group *group = data;
- struct tablet_pad_strip *tablet_strip =
- calloc(1, sizeof(struct tablet_pad_strip));
+ struct tablet_pad_strip *tablet_strip = calloc(1, sizeof(*tablet_strip));
if (!tablet_strip) {
zwp_tablet_pad_strip_v2_destroy(strip);
return;
@@ -296,8 +294,7 @@ static void handle_tablet_pad_group(void *data,
struct wlr_wl_seat *seat = data;
struct wlr_tablet_pad *pad = &seat->wlr_tablet_pad;
- struct tablet_pad_group *group =
- calloc(1, sizeof(struct tablet_pad_group));
+ struct tablet_pad_group *group = calloc(1, sizeof(*group));
if (!group) {
wlr_log_errno(WLR_ERROR, "failed to allocate tablet_pad_group");
zwp_tablet_pad_group_v2_destroy(pad_group);
@@ -788,7 +785,7 @@ static void handle_tool_added(void *data,
wl_signal_init(&seat->wlr_tablet_tool.events.destroy);
- struct tablet_tool *tool = calloc(1, sizeof(struct tablet_tool));
+ struct tablet_tool *tool = calloc(1, sizeof(*tool));
if (tool == NULL) {
wlr_log_errno(WLR_ERROR, "failed to allocate tablet_tool");
zwp_tablet_tool_v2_destroy(zwp_tablet_tool_v2);
diff --git a/backend/x11/input_device.c b/backend/x11/input_device.c
index f2966a22..b3bd77da 100644
--- a/backend/x11/input_device.c
+++ b/backend/x11/input_device.c
@@ -232,7 +232,7 @@ void handle_x11_xinput_event(struct wlr_x11_backend *x11,
id = last_touchpoint->wayland_id + 1;
}
- struct wlr_x11_touchpoint *touchpoint = calloc(1, sizeof(struct wlr_x11_touchpoint));
+ struct wlr_x11_touchpoint *touchpoint = calloc(1, sizeof(*touchpoint));
touchpoint->x11_id = ev->detail;
touchpoint->wayland_id = id;
wl_list_init(&touchpoint->link);
diff --git a/backend/x11/output.c b/backend/x11/output.c
index 553f56a8..f5dc527c 100644
--- a/backend/x11/output.c
+++ b/backend/x11/output.c
@@ -256,7 +256,7 @@ static struct wlr_x11_buffer *create_x11_buffer(struct wlr_x11_output *output,
return NULL;
}
- struct wlr_x11_buffer *buffer = calloc(1, sizeof(struct wlr_x11_buffer));
+ struct wlr_x11_buffer *buffer = calloc(1, sizeof(*buffer));
if (!buffer) {
xcb_free_pixmap(x11->xcb, pixmap);
return NULL;
@@ -535,7 +535,7 @@ struct wlr_output *wlr_x11_output_create(struct wlr_backend *backend) {
return NULL;
}
- struct wlr_x11_output *output = calloc(1, sizeof(struct wlr_x11_output));
+ struct wlr_x11_output *output = calloc(1, sizeof(*output));
if (output == NULL) {
return NULL;
}