mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2025-10-29 05:40:12 -04:00
treewide: Migrate from sizeof(struct) to sizeof(*pointer) where practical
This commit is contained in:
parent
a09d649439
commit
1b0694b794
99 changed files with 224 additions and 355 deletions
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue