treewide: Migrate from sizeof(struct) to sizeof(*pointer) where practical

This commit is contained in:
Alexander Orzechowski 2023-10-03 01:51:07 -04:00
parent a09d649439
commit 1b0694b794
99 changed files with 224 additions and 355 deletions

View file

@ -62,8 +62,7 @@ struct wlr_client_buffer *wlr_client_buffer_create(struct wlr_buffer *buffer,
return NULL;
}
struct wlr_client_buffer *client_buffer =
calloc(1, sizeof(struct wlr_client_buffer));
struct wlr_client_buffer *client_buffer = calloc(1, sizeof(*client_buffer));
if (client_buffer == NULL) {
wlr_texture_destroy(texture);
return NULL;

View file

@ -291,8 +291,7 @@ static void handle_display_destroy(struct wl_listener *listener, void *data) {
struct wlr_data_device_manager *wlr_data_device_manager_create(
struct wl_display *display) {
struct wlr_data_device_manager *manager =
calloc(1, sizeof(struct wlr_data_device_manager));
struct wlr_data_device_manager *manager = calloc(1, sizeof(*manager));
if (manager == NULL) {
wlr_log(WLR_ERROR, "could not create data device manager");
return NULL;

View file

@ -242,7 +242,7 @@ struct wlr_data_offer *data_offer_create(struct wl_resource *device_resource,
assert(seat_client != NULL);
assert(source != NULL); // a NULL source means no selection
struct wlr_data_offer *offer = calloc(1, sizeof(struct wlr_data_offer));
struct wlr_data_offer *offer = calloc(1, sizeof(*offer));
if (offer == NULL) {
return NULL;
}

View file

@ -235,8 +235,7 @@ static void data_source_handle_resource_destroy(struct wl_resource *resource) {
struct wlr_client_data_source *client_data_source_create(
struct wl_client *client, uint32_t version, uint32_t id,
struct wl_list *resource_list) {
struct wlr_client_data_source *source =
calloc(1, sizeof(struct wlr_client_data_source));
struct wlr_client_data_source *source = calloc(1, sizeof(*source));
if (source == NULL) {
return NULL;
}

View file

@ -378,7 +378,7 @@ static void drag_icon_handle_surface_destroy(struct wl_listener *listener,
static struct wlr_drag_icon *drag_icon_create(struct wlr_drag *drag,
struct wlr_surface *surface) {
struct wlr_drag_icon *icon = calloc(1, sizeof(struct wlr_drag_icon));
struct wlr_drag_icon *icon = calloc(1, sizeof(*icon));
if (!icon) {
return NULL;
}
@ -398,7 +398,7 @@ static struct wlr_drag_icon *drag_icon_create(struct wlr_drag *drag,
struct wlr_drag *wlr_drag_create(struct wlr_seat_client *seat_client,
struct wlr_data_source *source, struct wlr_surface *icon_surface) {
struct wlr_drag *drag = calloc(1, sizeof(struct wlr_drag));
struct wlr_drag *drag = calloc(1, sizeof(*drag));
if (drag == NULL) {
return NULL;
}

View file

@ -495,8 +495,7 @@ bool wlr_output_cursor_move(struct wlr_output_cursor *cursor,
}
struct wlr_output_cursor *wlr_output_cursor_create(struct wlr_output *output) {
struct wlr_output_cursor *cursor =
calloc(1, sizeof(struct wlr_output_cursor));
struct wlr_output_cursor *cursor = calloc(1, sizeof(*cursor));
if (cursor == NULL) {
return NULL;
}

View file

@ -149,7 +149,7 @@ static void scene_tree_init(struct wlr_scene_tree *tree,
}
struct wlr_scene *wlr_scene_create(void) {
struct wlr_scene *scene = calloc(1, sizeof(struct wlr_scene));
struct wlr_scene *scene = calloc(1, sizeof(*scene));
if (scene == NULL) {
return NULL;
}
@ -177,7 +177,7 @@ struct wlr_scene *wlr_scene_create(void) {
struct wlr_scene_tree *wlr_scene_tree_create(struct wlr_scene_tree *parent) {
assert(parent);
struct wlr_scene_tree *tree = calloc(1, sizeof(struct wlr_scene_tree));
struct wlr_scene_tree *tree = calloc(1, sizeof(*tree));
if (tree == NULL) {
return NULL;
}
@ -564,8 +564,7 @@ static void scene_node_update(struct wlr_scene_node *node,
struct wlr_scene_rect *wlr_scene_rect_create(struct wlr_scene_tree *parent,
int width, int height, const float color[static 4]) {
struct wlr_scene_rect *scene_rect =
calloc(1, sizeof(struct wlr_scene_rect));
struct wlr_scene_rect *scene_rect = calloc(1, sizeof(*scene_rect));
if (scene_rect == NULL) {
return NULL;
}
@ -1727,8 +1726,7 @@ bool wlr_scene_output_build_state(struct wlr_scene_output *scene_output,
// add the current frame's damage if there is damage
if (pixman_region32_not_empty(&scene_output->damage_ring.current)) {
struct highlight_region *current_damage =
calloc(1, sizeof(*current_damage));
struct highlight_region *current_damage = calloc(1, sizeof(*current_damage));
if (current_damage) {
pixman_region32_init(&current_damage->region);
pixman_region32_copy(&current_damage->region,

View file

@ -140,8 +140,7 @@ static const struct wl_seat_interface seat_impl = {
static struct wlr_seat_client *seat_client_create(struct wlr_seat *wlr_seat,
struct wl_client *client, struct wl_resource *wl_resource) {
struct wlr_seat_client *seat_client =
calloc(1, sizeof(struct wlr_seat_client));
struct wlr_seat_client *seat_client = calloc(1, sizeof(*seat_client));
if (!seat_client) {
return NULL;
}
@ -255,7 +254,7 @@ static void handle_display_destroy(struct wl_listener *listener, void *data) {
}
struct wlr_seat *wlr_seat_create(struct wl_display *display, const char *name) {
struct wlr_seat *seat = calloc(1, sizeof(struct wlr_seat));
struct wlr_seat *seat = calloc(1, sizeof(*seat));
if (!seat) {
return NULL;
}
@ -264,8 +263,7 @@ struct wlr_seat *wlr_seat_create(struct wl_display *display, const char *name) {
seat->pointer_state.seat = seat;
wl_list_init(&seat->pointer_state.surface_destroy.link);
struct wlr_seat_pointer_grab *pointer_grab =
calloc(1, sizeof(struct wlr_seat_pointer_grab));
struct wlr_seat_pointer_grab *pointer_grab = calloc(1, sizeof(*pointer_grab));
if (!pointer_grab) {
free(seat);
return NULL;
@ -278,8 +276,7 @@ struct wlr_seat *wlr_seat_create(struct wl_display *display, const char *name) {
wl_signal_init(&seat->pointer_state.events.focus_change);
// keyboard state
struct wlr_seat_keyboard_grab *keyboard_grab =
calloc(1, sizeof(struct wlr_seat_keyboard_grab));
struct wlr_seat_keyboard_grab *keyboard_grab = calloc(1, sizeof(*keyboard_grab));
if (!keyboard_grab) {
free(pointer_grab);
free(seat);
@ -296,8 +293,7 @@ struct wlr_seat *wlr_seat_create(struct wl_display *display, const char *name) {
wl_signal_init(&seat->keyboard_state.events.focus_change);
// touch state
struct wlr_seat_touch_grab *touch_grab =
calloc(1, sizeof(struct wlr_seat_touch_grab));
struct wlr_seat_touch_grab *touch_grab = calloc(1, sizeof(*touch_grab));
if (!touch_grab) {
free(pointer_grab);
free(keyboard_grab);

View file

@ -144,7 +144,7 @@ static struct wlr_touch_point *touch_point_create(
return NULL;
}
struct wlr_touch_point *point = calloc(1, sizeof(struct wlr_touch_point));
struct wlr_touch_point *point = calloc(1, sizeof(*point));
if (!point) {
return NULL;
}

View file

@ -45,8 +45,7 @@ static void handle_wlr_seat_destroy(struct wl_listener *listener, void *data) {
static struct wlr_tablet_seat_v2 *create_tablet_seat(
struct wlr_tablet_manager_v2 *manager,
struct wlr_seat *wlr_seat) {
struct wlr_tablet_seat_v2 *tablet_seat =
calloc(1, sizeof(struct wlr_tablet_seat_v2));
struct wlr_tablet_seat_v2 *tablet_seat = calloc(1, sizeof(*tablet_seat));
if (!tablet_seat) {
return NULL;
}
@ -175,8 +174,7 @@ static void get_tablet_seat(struct wl_client *wl_client, struct wl_resource *res
return;
}
struct wlr_tablet_seat_client_v2 *seat_client =
calloc(1, sizeof(struct wlr_tablet_seat_client_v2));
struct wlr_tablet_seat_client_v2 *seat_client = calloc(1, sizeof(*seat_client));
if (seat_client == NULL) {
wl_client_post_no_memory(wl_client);
return;
@ -250,8 +248,7 @@ static void tablet_v2_bind(struct wl_client *wl_client, void *data,
struct wlr_tablet_manager_v2 *manager = data;
assert(wl_client && manager);
struct wlr_tablet_manager_client_v2 *client =
calloc(1, sizeof(struct wlr_tablet_manager_client_v2));
struct wlr_tablet_manager_client_v2 *client = calloc(1, sizeof(*client));
if (client == NULL) {
wl_client_post_no_memory(wl_client);
return;
@ -284,8 +281,7 @@ static void handle_display_destroy(struct wl_listener *listener, void *data) {
}
struct wlr_tablet_manager_v2 *wlr_tablet_v2_create(struct wl_display *display) {
struct wlr_tablet_manager_v2 *tablet =
calloc(1, sizeof(struct wlr_tablet_manager_v2));
struct wlr_tablet_manager_v2 *tablet = calloc(1, sizeof(*tablet));
if (!tablet) {
return NULL;
}

View file

@ -200,8 +200,7 @@ static void add_tablet_pad_group(struct wlr_tablet_v2_tablet_pad *pad,
wl_client_post_no_memory(client->client);
return;
}
struct tablet_pad_auxiliary_user_data *user_data =
calloc(1, sizeof(struct tablet_pad_auxiliary_user_data));
struct tablet_pad_auxiliary_user_data *user_data = calloc(1, sizeof(*user_data));
if (!user_data) {
wl_client_post_no_memory(client->client);
return;
@ -224,8 +223,7 @@ static void add_tablet_pad_group(struct wlr_tablet_v2_tablet_pad *pad,
client->strip_count = group->strip_count;
for (size_t i = 0; i < group->strip_count; ++i) {
size_t strip = group->strips[i];
struct tablet_pad_auxiliary_user_data *user_data =
calloc(1, sizeof(struct tablet_pad_auxiliary_user_data));
struct tablet_pad_auxiliary_user_data *user_data = calloc(1, sizeof(*user_data));
if (!user_data) {
wl_client_post_no_memory(client->client);
return;
@ -248,8 +246,7 @@ static void add_tablet_pad_group(struct wlr_tablet_v2_tablet_pad *pad,
client->ring_count = group->ring_count;
for (size_t i = 0; i < group->ring_count; ++i) {
size_t ring = group->rings[i];
struct tablet_pad_auxiliary_user_data *user_data =
calloc(1, sizeof(struct tablet_pad_auxiliary_user_data));
struct tablet_pad_auxiliary_user_data *user_data = calloc(1, sizeof(*user_data));
if (!user_data) {
wl_client_post_no_memory(client->client);
return;
@ -274,8 +271,7 @@ static void add_tablet_pad_group(struct wlr_tablet_v2_tablet_pad *pad,
void add_tablet_pad_client(struct wlr_tablet_seat_client_v2 *seat,
struct wlr_tablet_v2_tablet_pad *pad) {
struct wlr_tablet_pad_client_v2 *client =
calloc(1, sizeof(struct wlr_tablet_pad_client_v2));
struct wlr_tablet_pad_client_v2 *client = calloc(1, sizeof(*client));
if (!client) {
wl_client_post_no_memory(seat->wl_client);
return;
@ -283,14 +279,14 @@ void add_tablet_pad_client(struct wlr_tablet_seat_client_v2 *seat,
client->pad = pad;
client->seat = seat;
client->groups = calloc(wl_list_length(&pad->wlr_pad->groups), sizeof(struct wl_resource*));
client->groups = calloc(wl_list_length(&pad->wlr_pad->groups), sizeof(*client->groups));
if (!client->groups) {
wl_client_post_no_memory(seat->wl_client);
free(client);
return;
}
client->rings = calloc(pad->wlr_pad->ring_count, sizeof(struct wl_resource*));
client->rings = calloc(pad->wlr_pad->ring_count, sizeof(*client->rings));
if (!client->rings) {
wl_client_post_no_memory(seat->wl_client);
free(client->groups);
@ -298,7 +294,7 @@ void add_tablet_pad_client(struct wlr_tablet_seat_client_v2 *seat,
return;
}
client->strips = calloc(pad->wlr_pad->strip_count, sizeof(struct wl_resource*));
client->strips = calloc(pad->wlr_pad->strip_count, sizeof(*client->strips));
if (!client->strips) {
wl_client_post_no_memory(seat->wl_client);
free(client->groups);
@ -376,7 +372,7 @@ struct wlr_tablet_v2_tablet_pad *wlr_tablet_pad_create(
return NULL;
}
struct wlr_tablet_pad *wlr_pad = wlr_tablet_pad_from_input_device(wlr_device);
struct wlr_tablet_v2_tablet_pad *pad = calloc(1, sizeof(struct wlr_tablet_v2_tablet_pad));
struct wlr_tablet_v2_tablet_pad *pad = calloc(1, sizeof(*pad));
if (!pad) {
return NULL;
}

View file

@ -61,7 +61,7 @@ struct wlr_tablet_v2_tablet *wlr_tablet_create(
return NULL;
}
struct wlr_tablet *wlr_tablet = wlr_tablet_from_input_device(wlr_device);
struct wlr_tablet_v2_tablet *tablet = calloc(1, sizeof(struct wlr_tablet_v2_tablet));
struct wlr_tablet_v2_tablet *tablet = calloc(1, sizeof(*tablet));
if (!tablet) {
return NULL;
}
@ -88,8 +88,7 @@ struct wlr_tablet_v2_tablet *wlr_tablet_create(
void add_tablet_client(struct wlr_tablet_seat_client_v2 *seat,
struct wlr_tablet_v2_tablet *tablet) {
struct wlr_tablet_client_v2 *client =
calloc(1, sizeof(struct wlr_tablet_client_v2));
struct wlr_tablet_client_v2 *client = calloc(1, sizeof(*client));
if (!client) {
return;
}

View file

@ -119,8 +119,7 @@ void destroy_tablet_tool_v2(struct wl_resource *resource) {
void add_tablet_tool_client(struct wlr_tablet_seat_client_v2 *seat,
struct wlr_tablet_v2_tablet_tool *tool) {
struct wlr_tablet_tool_client_v2 *client =
calloc(1, sizeof(struct wlr_tablet_tool_client_v2));
struct wlr_tablet_tool_client_v2 *client = calloc(1, sizeof(*client));
if (!client) {
return;
}
@ -233,8 +232,7 @@ struct wlr_tablet_v2_tablet_tool *wlr_tablet_tool_create(
if (!seat) {
return NULL;
}
struct wlr_tablet_v2_tablet_tool *tool =
calloc(1, sizeof(struct wlr_tablet_v2_tablet_tool));
struct wlr_tablet_v2_tablet_tool *tool = calloc(1, sizeof(*tool));
if (!tool) {
return NULL;
}
@ -822,15 +820,14 @@ void wlr_tablet_tool_v2_start_implicit_grab(
return;
}
struct wlr_tablet_tool_v2_grab *grab =
calloc(1, sizeof(struct wlr_tablet_tool_v2_grab));
struct wlr_tablet_tool_v2_grab *grab = calloc(1, sizeof(*grab));
if (!grab) {
return;
}
grab->interface = &implicit_tool_grab_interface;
grab->tool = tool;
struct implicit_grab_state *state = calloc(1, sizeof(struct implicit_grab_state));
struct implicit_grab_state *state = calloc(1, sizeof(*state));
if (!state) {
free(grab);
return;

View file

@ -671,7 +671,7 @@ static void surface_handle_renderer_destroy(struct wl_listener *listener,
static struct wlr_surface *surface_create(struct wl_client *client,
uint32_t version, uint32_t id, struct wlr_renderer *renderer) {
struct wlr_surface *surface = calloc(1, sizeof(struct wlr_surface));
struct wlr_surface *surface = calloc(1, sizeof(*surface));
if (!surface) {
wl_client_post_no_memory(client);
return NULL;
@ -970,7 +970,7 @@ void wlr_surface_send_enter(struct wlr_surface *surface,
}
}
surface_output = calloc(1, sizeof(struct wlr_surface_output));
surface_output = calloc(1, sizeof(*surface_output));
if (surface_output == NULL) {
return;
}

View file

@ -104,7 +104,7 @@ struct wlr_cursor_state {
};
struct wlr_cursor *wlr_cursor_create(void) {
struct wlr_cursor_state *state = calloc(1, sizeof(struct wlr_cursor_state));
struct wlr_cursor_state *state = calloc(1, sizeof(*state));
if (!state) {
wlr_log(WLR_ERROR, "Failed to allocate wlr_cursor_state");
return NULL;
@ -916,8 +916,7 @@ static void handle_device_destroy(struct wl_listener *listener, void *data) {
static struct wlr_cursor_device *cursor_device_create(
struct wlr_cursor *cursor, struct wlr_input_device *device) {
struct wlr_cursor_device *c_device =
calloc(1, sizeof(struct wlr_cursor_device));
struct wlr_cursor_device *c_device = calloc(1, sizeof(*c_device));
if (!c_device) {
wlr_log(WLR_ERROR, "Failed to allocate wlr_cursor_device");
return NULL;
@ -1065,7 +1064,7 @@ static void layout_add(struct wlr_cursor_state *state,
}
}
output_cursor = calloc(1, sizeof(struct wlr_cursor_output_cursor));
output_cursor = calloc(1, sizeof(*output_cursor));
if (output_cursor == NULL) {
wlr_log(WLR_ERROR, "Failed to allocate wlr_cursor_output_cursor");
return;

View file

@ -288,7 +288,7 @@ static struct wl_resource *create_offer(struct wlr_data_control_device_v1 *devic
struct wl_array *mime_types, bool is_primary) {
struct wl_client *client = wl_resource_get_client(device->resource);
struct data_offer *offer = calloc(1, sizeof(struct data_offer));
struct data_offer *offer = calloc(1, sizeof(*offer));
if (offer == NULL) {
wl_client_post_no_memory(client);
return NULL;
@ -361,8 +361,7 @@ static void control_handle_set_selection(struct wl_client *client,
return;
}
struct client_data_source *client_source =
calloc(1, sizeof(struct client_data_source));
struct client_data_source *client_source = calloc(1, sizeof(*client_source));
if (client_source == NULL) {
wl_client_post_no_memory(client);
return;
@ -414,8 +413,7 @@ static void control_handle_set_primary_selection(struct wl_client *client,
return;
}
struct client_primary_selection_source *client_source =
calloc(1, sizeof(struct client_primary_selection_source));
struct client_primary_selection_source *client_source = calloc(1, sizeof(*client_source));
if (client_source == NULL) {
wl_client_post_no_memory(client);
return;
@ -565,8 +563,7 @@ static struct wlr_data_control_manager_v1 *manager_from_resource(
static void manager_handle_create_data_source(struct wl_client *client,
struct wl_resource *manager_resource, uint32_t id) {
struct data_control_source *source =
calloc(1, sizeof(struct data_control_source));
struct data_control_source *source = calloc(1, sizeof(*source));
if (source == NULL) {
wl_resource_post_no_memory(manager_resource);
return;
@ -608,8 +605,7 @@ static void manager_handle_get_data_device(struct wl_client *client,
return;
}
struct wlr_data_control_device_v1 *device =
calloc(1, sizeof(struct wlr_data_control_device_v1));
struct wlr_data_control_device_v1 *device = calloc(1, sizeof(*device));
if (device == NULL) {
wl_resource_post_no_memory(manager_resource);
return;
@ -678,8 +674,7 @@ static void handle_display_destroy(struct wl_listener *listener, void *data) {
struct wlr_data_control_manager_v1 *wlr_data_control_manager_v1_create(
struct wl_display *display) {
struct wlr_data_control_manager_v1 *manager =
calloc(1, sizeof(struct wlr_data_control_manager_v1));
struct wlr_data_control_manager_v1 *manager = calloc(1, sizeof(*manager));
if (manager == NULL) {
return NULL;
}

View file

@ -180,8 +180,7 @@ struct wlr_drm_lease_v1 *wlr_drm_lease_request_v1_grant(
return NULL;
}
lease->connectors = calloc(request->n_connectors,
sizeof(struct wlr_drm_lease_connector_v1 *));
lease->connectors = calloc(request->n_connectors, sizeof(*lease->connectors));
if (!lease->connectors) {
wlr_log(WLR_ERROR, "Failed to allocate lease connectors list");
close(fd);
@ -399,8 +398,7 @@ static void drm_lease_device_v1_handle_create_lease_request(
return;
}
struct wlr_drm_lease_request_v1 *req =
calloc(1, sizeof(struct wlr_drm_lease_request_v1));
struct wlr_drm_lease_request_v1 *req = calloc(1, sizeof(*req));
if (!req) {
wlr_log(WLR_ERROR, "Failed to allocate wlr_drm_lease_request_v1");
wl_resource_post_no_memory(resource);
@ -553,8 +551,7 @@ bool wlr_drm_lease_v1_manager_offer_output(
}
}
struct wlr_drm_lease_connector_v1 *connector =
calloc(1, sizeof(struct wlr_drm_lease_connector_v1));
struct wlr_drm_lease_connector_v1 *connector = calloc(1, sizeof(*connector));
if (!connector) {
wlr_log(WLR_ERROR, "Failed to allocate wlr_drm_lease_connector_v1");
return false;
@ -638,8 +635,7 @@ static void drm_lease_device_v1_create(struct wlr_drm_lease_v1_manager *manager,
wlr_log(WLR_DEBUG, "Creating wlr_drm_lease_device_v1 for %s",
drm_backend->name);
struct wlr_drm_lease_device_v1 *lease_device =
calloc(1, sizeof(struct wlr_drm_lease_device_v1));
struct wlr_drm_lease_device_v1 *lease_device = calloc(1, sizeof(*lease_device));
if (!lease_device) {
wlr_log(WLR_ERROR, "Failed to allocate wlr_drm_lease_device_v1");
@ -694,8 +690,7 @@ static void handle_display_destroy(struct wl_listener *listener, void *data) {
struct wlr_drm_lease_v1_manager *wlr_drm_lease_v1_manager_create(
struct wl_display *display, struct wlr_backend *backend) {
struct wlr_drm_lease_v1_manager *manager = calloc(1,
sizeof(struct wlr_drm_lease_v1_manager));
struct wlr_drm_lease_v1_manager *manager = calloc(1, sizeof(*manager));
if (!manager) {
wlr_log(WLR_ERROR, "Failed to allocate wlr_drm_lease_v1_manager");
return NULL;

View file

@ -115,8 +115,7 @@ static void manager_handle_capture_output(struct wl_client *client,
manager_from_resource(manager_resource);
struct wlr_output *output = wlr_output_from_resource(output_resource);
struct wlr_export_dmabuf_frame_v1 *frame =
calloc(1, sizeof(struct wlr_export_dmabuf_frame_v1));
struct wlr_export_dmabuf_frame_v1 *frame = calloc(1, sizeof(*frame));
if (frame == NULL) {
wl_resource_post_no_memory(manager_resource);
return;
@ -200,8 +199,7 @@ static void handle_display_destroy(struct wl_listener *listener, void *data) {
struct wlr_export_dmabuf_manager_v1 *wlr_export_dmabuf_manager_v1_create(
struct wl_display *display) {
struct wlr_export_dmabuf_manager_v1 *manager =
calloc(1, sizeof(struct wlr_export_dmabuf_manager_v1));
struct wlr_export_dmabuf_manager_v1 *manager = calloc(1, sizeof(*manager));
if (manager == NULL) {
return NULL;
}

View file

@ -291,8 +291,7 @@ void wlr_foreign_toplevel_handle_v1_output_enter(
}
}
toplevel_output =
calloc(1, sizeof(struct wlr_foreign_toplevel_handle_v1_output));
toplevel_output = calloc(1, sizeof(*toplevel_output));
if (!toplevel_output) {
wlr_log(WLR_ERROR, "failed to allocate memory for toplevel output");
return;
@ -560,8 +559,7 @@ static struct wl_resource *create_toplevel_resource_for_resource(
struct wlr_foreign_toplevel_handle_v1 *
wlr_foreign_toplevel_handle_v1_create(
struct wlr_foreign_toplevel_manager_v1 *manager) {
struct wlr_foreign_toplevel_handle_v1 *toplevel = calloc(1,
sizeof(struct wlr_foreign_toplevel_handle_v1));
struct wlr_foreign_toplevel_handle_v1 *toplevel = calloc(1, sizeof(*toplevel));
if (!toplevel) {
return NULL;
}
@ -685,8 +683,7 @@ static void handle_display_destroy(struct wl_listener *listener, void *data) {
struct wlr_foreign_toplevel_manager_v1 *wlr_foreign_toplevel_manager_v1_create(
struct wl_display *display) {
struct wlr_foreign_toplevel_manager_v1 *manager = calloc(1,
sizeof(struct wlr_foreign_toplevel_manager_v1));
struct wlr_foreign_toplevel_manager_v1 *manager = calloc(1, sizeof(*manager));
if (!manager) {
return NULL;
}

View file

@ -116,8 +116,7 @@ static void handle_display_destroy(struct wl_listener *listener, void *data) {
struct wlr_fullscreen_shell_v1 *wlr_fullscreen_shell_v1_create(
struct wl_display *display) {
struct wlr_fullscreen_shell_v1 *shell =
calloc(1, sizeof(struct wlr_fullscreen_shell_v1));
struct wlr_fullscreen_shell_v1 *shell = calloc(1, sizeof(*shell));
if (shell == NULL) {
return NULL;
}

View file

@ -170,8 +170,7 @@ static void gamma_control_manager_get_gamma_control(struct wl_client *client,
return;
}
struct wlr_gamma_control_v1 *gamma_control =
calloc(1, sizeof(struct wlr_gamma_control_v1));
struct wlr_gamma_control_v1 *gamma_control = calloc(1, sizeof(*gamma_control));
if (gamma_control == NULL) {
wl_client_post_no_memory(client);
return;
@ -226,8 +225,7 @@ static void handle_display_destroy(struct wl_listener *listener, void *data) {
struct wlr_gamma_control_manager_v1 *wlr_gamma_control_manager_v1_create(
struct wl_display *display) {
struct wlr_gamma_control_manager_v1 *manager =
calloc(1, sizeof(struct wlr_gamma_control_manager_v1));
struct wlr_gamma_control_manager_v1 *manager = calloc(1, sizeof(*manager));
if (!manager) {
return NULL;
}

View file

@ -101,8 +101,7 @@ static void handle_input_notification(struct wl_listener *listener, void *data)
static struct wlr_idle_timeout *create_timer(struct wlr_idle *idle,
struct wlr_seat *seat, uint32_t timeout, struct wl_resource *resource) {
struct wlr_idle_timeout *timer =
calloc(1, sizeof(struct wlr_idle_timeout));
struct wlr_idle_timeout *timer = calloc(1, sizeof(*timer));
if (!timer) {
return NULL;
}
@ -221,7 +220,7 @@ static void handle_display_destroy(struct wl_listener *listener, void *data) {
}
struct wlr_idle *wlr_idle_create(struct wl_display *display) {
struct wlr_idle *idle = calloc(1, sizeof(struct wlr_idle));
struct wlr_idle *idle = calloc(1, sizeof(*idle));
if (!idle) {
return NULL;
}

View file

@ -70,8 +70,7 @@ static void manager_handle_create_inhibitor(struct wl_client *client,
struct wlr_idle_inhibit_manager_v1 *manager =
wlr_idle_inhibit_manager_v1_from_resource(manager_resource);
struct wlr_idle_inhibitor_v1 *inhibitor =
calloc(1, sizeof(struct wlr_idle_inhibitor_v1));
struct wlr_idle_inhibitor_v1 *inhibitor = calloc(1, sizeof(*inhibitor));
if (!inhibitor) {
wl_client_post_no_memory(client);
return;
@ -135,8 +134,7 @@ static void idle_inhibit_bind(struct wl_client *wl_client, void *data,
}
struct wlr_idle_inhibit_manager_v1 *wlr_idle_inhibit_v1_create(struct wl_display *display) {
struct wlr_idle_inhibit_manager_v1 *manager =
calloc(1, sizeof(struct wlr_idle_inhibit_manager_v1));
struct wlr_idle_inhibit_manager_v1 *manager = calloc(1, sizeof(*manager));
if (!manager) {
return NULL;
}

View file

@ -114,8 +114,7 @@ static void handle_display_destroy(struct wl_listener *listener, void *data) {
struct wlr_input_inhibit_manager *wlr_input_inhibit_manager_create(
struct wl_display *display) {
// TODO: Client destroy
struct wlr_input_inhibit_manager *manager =
calloc(1, sizeof(struct wlr_input_inhibit_manager));
struct wlr_input_inhibit_manager *manager = calloc(1, sizeof(*manager));
if (!manager) {
return NULL;
}

View file

@ -206,8 +206,7 @@ static void im_get_input_popup_surface(struct wl_client *client,
return;
}
struct wlr_input_popup_surface_v2 *popup_surface =
calloc(1, sizeof(struct wlr_input_popup_surface_v2));
struct wlr_input_popup_surface_v2 *popup_surface = calloc(1, sizeof(*popup_surface));
if (!popup_surface) {
wl_client_post_no_memory(client);
return;
@ -410,8 +409,7 @@ static void im_grab_keyboard(struct wl_client *client,
// Already grabbed
return;
}
struct wlr_input_method_keyboard_grab_v2 *keyboard_grab =
calloc(1, sizeof(struct wlr_input_method_keyboard_grab_v2));
struct wlr_input_method_keyboard_grab_v2 *keyboard_grab = calloc(1, sizeof(*keyboard_grab));
if (!keyboard_grab) {
wl_client_post_no_memory(client);
return;
@ -535,8 +533,7 @@ static void manager_get_input_method(struct wl_client *client,
return;
}
struct wlr_input_method_v2 *input_method = calloc(1,
sizeof(struct wlr_input_method_v2));
struct wlr_input_method_v2 *input_method = calloc(1, sizeof(*input_method));
if (!input_method) {
wl_client_post_no_memory(client);
return;
@ -598,8 +595,7 @@ static void handle_display_destroy(struct wl_listener *listener, void *data) {
struct wlr_input_method_manager_v2 *wlr_input_method_manager_v2_create(
struct wl_display *display) {
struct wlr_input_method_manager_v2 *im_manager = calloc(1,
sizeof(struct wlr_input_method_manager_v2));
struct wlr_input_method_manager_v2 *im_manager = calloc(1, sizeof(*im_manager));
if (!im_manager) {
return NULL;
}

View file

@ -42,8 +42,7 @@ static const struct wlr_keyboard_impl impl = {
};
struct wlr_keyboard_group *wlr_keyboard_group_create(void) {
struct wlr_keyboard_group *group =
calloc(1, sizeof(struct wlr_keyboard_group));
struct wlr_keyboard_group *group = calloc(1, sizeof(*group));
if (!group) {
wlr_log(WLR_ERROR, "Failed to allocate wlr_keyboard_group");
return NULL;
@ -93,8 +92,7 @@ static bool process_key(struct keyboard_group_device *group_device,
}
if (event->state == WL_KEYBOARD_KEY_STATE_PRESSED) {
struct keyboard_group_key *key =
calloc(1, sizeof(struct keyboard_group_key));
struct keyboard_group_key *key = calloc(1, sizeof(*key));
if (!key) {
wlr_log(WLR_ERROR, "Failed to allocate keyboard_group_key");
return false;
@ -256,8 +254,7 @@ bool wlr_keyboard_group_add_keyboard(struct wlr_keyboard_group *group,
return false;
}
struct keyboard_group_device *device =
calloc(1, sizeof(struct keyboard_group_device));
struct keyboard_group_device *device = calloc(1, sizeof(*device));
if (!device) {
wlr_log(WLR_ERROR, "Failed to allocate keyboard_group_device");
return false;

View file

@ -122,8 +122,7 @@ static void manager_handle_inhibit_shortcuts(struct wl_client *client,
return;
}
struct wlr_keyboard_shortcuts_inhibitor_v1 *inhibitor =
calloc(1, sizeof(struct wlr_keyboard_shortcuts_inhibitor_v1));
struct wlr_keyboard_shortcuts_inhibitor_v1 *inhibitor = calloc(1, sizeof(*inhibitor));
if (!inhibitor) {
wl_client_post_no_memory(client);
return;
@ -186,8 +185,7 @@ static void keyboard_shortcuts_inhibit_bind(struct wl_client *wl_client,
struct wlr_keyboard_shortcuts_inhibit_manager_v1 *
wlr_keyboard_shortcuts_inhibit_v1_create(struct wl_display *display) {
struct wlr_keyboard_shortcuts_inhibit_manager_v1 *manager =
calloc(1, sizeof(struct wlr_keyboard_shortcuts_inhibit_manager_v1));
struct wlr_keyboard_shortcuts_inhibit_manager_v1 *manager = calloc(1, sizeof(*manager));
if (!manager) {
return NULL;
}

View file

@ -277,8 +277,7 @@ uint32_t wlr_layer_surface_v1_configure(struct wlr_layer_surface_v1 *surface,
uint32_t width, uint32_t height) {
struct wl_display *display =
wl_client_get_display(wl_resource_get_client(surface->resource));
struct wlr_layer_surface_v1_configure *configure =
calloc(1, sizeof(struct wlr_layer_surface_v1_configure));
struct wlr_layer_surface_v1_configure *configure = calloc(1, sizeof(*configure));
if (configure == NULL) {
wl_client_post_no_memory(wl_resource_get_client(surface->resource));
return surface->pending.configure_serial;
@ -395,8 +394,7 @@ static void layer_shell_handle_get_layer_surface(struct wl_client *wl_client,
struct wlr_surface *wlr_surface =
wlr_surface_from_resource(surface_resource);
struct wlr_layer_surface_v1 *surface =
calloc(1, sizeof(struct wlr_layer_surface_v1));
struct wlr_layer_surface_v1 *surface = calloc(1, sizeof(*surface));
if (surface == NULL) {
wl_client_post_no_memory(wl_client);
return;
@ -485,8 +483,7 @@ struct wlr_layer_shell_v1 *wlr_layer_shell_v1_create(struct wl_display *display,
uint32_t version) {
assert(version <= LAYER_SHELL_VERSION);
struct wlr_layer_shell_v1 *layer_shell =
calloc(1, sizeof(struct wlr_layer_shell_v1));
struct wlr_layer_shell_v1 *layer_shell = calloc(1, sizeof(*layer_shell));
if (!layer_shell) {
return NULL;
}

View file

@ -556,8 +556,7 @@ static struct wlr_linux_dmabuf_feedback_v1_compiled *feedback_compile(
munmap(table, table_size);
struct wlr_linux_dmabuf_feedback_v1_compiled *compiled = calloc(1,
sizeof(struct wlr_linux_dmabuf_feedback_v1_compiled) +
struct wlr_linux_dmabuf_feedback_v1_compiled *compiled = calloc(1, sizeof(*compiled) +
tranches_len * sizeof(struct wlr_linux_dmabuf_feedback_v1_compiled_tranche));
if (compiled == NULL) {
close(ro_fd);
@ -938,8 +937,7 @@ struct wlr_linux_dmabuf_v1 *wlr_linux_dmabuf_v1_create(struct wl_display *displa
uint32_t version, const struct wlr_linux_dmabuf_feedback_v1 *default_feedback) {
assert(version <= LINUX_DMABUF_VERSION);
struct wlr_linux_dmabuf_v1 *linux_dmabuf =
calloc(1, sizeof(struct wlr_linux_dmabuf_v1));
struct wlr_linux_dmabuf_v1 *linux_dmabuf = calloc(1, sizeof(*linux_dmabuf));
if (linux_dmabuf == NULL) {
wlr_log(WLR_ERROR, "could not create simple dmabuf manager");
return NULL;

View file

@ -10,8 +10,7 @@
static const struct wlr_addon_interface addon_impl;
struct wlr_output_layout *wlr_output_layout_create(void) {
struct wlr_output_layout *layout =
calloc(1, sizeof(struct wlr_output_layout));
struct wlr_output_layout *layout = calloc(1, sizeof(*layout));
if (layout == NULL) {
return NULL;
}
@ -142,8 +141,7 @@ static const struct wlr_addon_interface addon_impl = {
static struct wlr_output_layout_output *output_layout_output_create(
struct wlr_output_layout *layout, struct wlr_output *output) {
struct wlr_output_layout_output *l_output =
calloc(1, sizeof(struct wlr_output_layout_output));
struct wlr_output_layout_output *l_output = calloc(1, sizeof(*l_output));
if (l_output == NULL) {
return NULL;
}

View file

@ -117,8 +117,7 @@ static void output_power_manager_get_output_power(struct wl_client *client,
output_power_manager_from_resource(manager_resource);
struct wlr_output *output = wlr_output_from_resource(output_resource);
struct wlr_output_power_v1 *output_power =
calloc(1, sizeof(struct wlr_output_power_v1));
struct wlr_output_power_v1 *output_power = calloc(1, sizeof(*output_power));
if (output_power == NULL) {
wl_client_post_no_memory(client);
return;
@ -202,8 +201,7 @@ static void handle_display_destroy(struct wl_listener *listener, void *data) {
struct wlr_output_power_manager_v1 *wlr_output_power_manager_v1_create(
struct wl_display *display) {
struct wlr_output_power_manager_v1 *manager =
calloc(1, sizeof(struct wlr_output_power_manager_v1));
struct wlr_output_power_manager_v1 *manager = calloc(1, sizeof(*manager));
if (!manager) {
return NULL;
}

View file

@ -407,8 +407,7 @@ static void handle_display_destroy(struct wl_listener *listener, void *data) {
struct wlr_pointer_gestures_v1 *wlr_pointer_gestures_v1_create(
struct wl_display *display) {
struct wlr_pointer_gestures_v1 *gestures =
calloc(1, sizeof(struct wlr_pointer_gestures_v1));
struct wlr_pointer_gestures_v1 *gestures = calloc(1, sizeof(*gestures));
if (!gestures) {
return NULL;
}

View file

@ -122,7 +122,7 @@ static void presentation_handle_feedback(struct wl_client *client,
struct wlr_presentation_feedback *feedback = p_surface->pending.feedback;
if (feedback == NULL) {
feedback = calloc(1, sizeof(struct wlr_presentation_feedback));
feedback = calloc(1, sizeof(*feedback));
if (feedback == NULL) {
wl_client_post_no_memory(client);
return;
@ -182,8 +182,7 @@ static void handle_display_destroy(struct wl_listener *listener, void *data) {
struct wlr_presentation *wlr_presentation_create(struct wl_display *display,
struct wlr_backend *backend) {
struct wlr_presentation *presentation =
calloc(1, sizeof(struct wlr_presentation));
struct wlr_presentation *presentation = calloc(1, sizeof(*presentation));
if (presentation == NULL) {
return NULL;
}

View file

@ -306,7 +306,7 @@ static struct wlr_primary_selection_v1_device *get_or_create_device(
}
}
device = calloc(1, sizeof(struct wlr_primary_selection_v1_device));
device = calloc(1, sizeof(*device));
if (device == NULL) {
return NULL;
}
@ -369,8 +369,7 @@ static struct wlr_primary_selection_v1_device_manager *manager_from_resource(
static void device_manager_handle_create_source(struct wl_client *client,
struct wl_resource *manager_resource, uint32_t id) {
struct client_data_source *source =
calloc(1, sizeof(struct client_data_source));
struct client_data_source *source = calloc(1, sizeof(*source));
if (source == NULL) {
wl_client_post_no_memory(client);
return;
@ -472,8 +471,7 @@ static void handle_display_destroy(struct wl_listener *listener, void *data) {
struct wlr_primary_selection_v1_device_manager *
wlr_primary_selection_v1_device_manager_create(
struct wl_display *display) {
struct wlr_primary_selection_v1_device_manager *manager =
calloc(1, sizeof(struct wlr_primary_selection_v1_device_manager));
struct wlr_primary_selection_v1_device_manager *manager = calloc(1, sizeof(*manager));
if (manager == NULL) {
return NULL;
}

View file

@ -53,7 +53,7 @@ static void region_handle_resource_destroy(struct wl_resource *resource) {
struct wl_resource *region_create(struct wl_client *client,
uint32_t version, uint32_t id) {
pixman_region32_t *region = calloc(1, sizeof(pixman_region32_t));
pixman_region32_t *region = calloc(1, sizeof(*region));
if (region == NULL) {
wl_client_post_no_memory(client);
return NULL;

View file

@ -92,8 +92,7 @@ static void relative_pointer_manager_v1_handle_get_relative_pointer(struct wl_cl
return;
}
struct wlr_relative_pointer_v1 *relative_pointer =
calloc(1, sizeof(struct wlr_relative_pointer_v1));
struct wlr_relative_pointer_v1 *relative_pointer = calloc(1, sizeof(*relative_pointer));
if (relative_pointer == NULL) {
wl_client_post_no_memory(client);
return;
@ -155,8 +154,7 @@ static const struct zwp_relative_pointer_v1_interface relative_pointer_v1_impl =
};
struct wlr_relative_pointer_manager_v1 *wlr_relative_pointer_manager_v1_create(struct wl_display *display) {
struct wlr_relative_pointer_manager_v1 *manager =
calloc(1, sizeof(struct wlr_relative_pointer_manager_v1));
struct wlr_relative_pointer_manager_v1 *manager = calloc(1, sizeof(*manager));
if (manager == NULL) {
return NULL;
}

View file

@ -83,8 +83,7 @@ static void screencopy_damage_handle_output_destroy(
static struct screencopy_damage *screencopy_damage_create(
struct wlr_screencopy_v1_client *client,
struct wlr_output *output) {
struct screencopy_damage *damage =
calloc(1, sizeof(struct screencopy_damage));
struct screencopy_damage *damage = calloc(1, sizeof(*damage));
if (!damage) {
return NULL;
}
@ -475,8 +474,7 @@ static void capture_output(struct wl_client *wl_client,
struct wlr_screencopy_v1_client *client, uint32_t version,
uint32_t id, int32_t overlay_cursor, struct wlr_output *output,
const struct wlr_box *box) {
struct wlr_screencopy_frame_v1 *frame =
calloc(1, sizeof(struct wlr_screencopy_frame_v1));
struct wlr_screencopy_frame_v1 *frame = calloc(1, sizeof(*frame));
if (frame == NULL) {
wl_client_post_no_memory(wl_client);
return;
@ -634,8 +632,7 @@ static void manager_bind(struct wl_client *wl_client, void *data,
uint32_t version, uint32_t id) {
struct wlr_screencopy_manager_v1 *manager = data;
struct wlr_screencopy_v1_client *client =
calloc(1, sizeof(struct wlr_screencopy_v1_client));
struct wlr_screencopy_v1_client *client = calloc(1, sizeof(*client));
if (client == NULL) {
goto failure;
}
@ -670,8 +667,7 @@ static void handle_display_destroy(struct wl_listener *listener, void *data) {
struct wlr_screencopy_manager_v1 *wlr_screencopy_manager_v1_create(
struct wl_display *display) {
struct wlr_screencopy_manager_v1 *manager =
calloc(1, sizeof(struct wlr_screencopy_manager_v1));
struct wlr_screencopy_manager_v1 *manager = calloc(1, sizeof(*manager));
if (manager == NULL) {
return NULL;
}

View file

@ -81,8 +81,7 @@ static void server_decoration_manager_handle_create(struct wl_client *client,
manager_from_resource(manager_resource);
struct wlr_surface *surface = wlr_surface_from_resource(surface_resource);
struct wlr_server_decoration *decoration =
calloc(1, sizeof(struct wlr_server_decoration));
struct wlr_server_decoration *decoration = calloc(1, sizeof(*decoration));
if (decoration == NULL) {
wl_client_post_no_memory(client);
return;
@ -173,8 +172,7 @@ static void handle_display_destroy(struct wl_listener *listener, void *data) {
struct wlr_server_decoration_manager *wlr_server_decoration_manager_create(
struct wl_display *display) {
struct wlr_server_decoration_manager *manager =
calloc(1, sizeof(struct wlr_server_decoration_manager));
struct wlr_server_decoration_manager *manager = calloc(1, sizeof(*manager));
if (manager == NULL) {
return NULL;
}

View file

@ -80,8 +80,7 @@ struct wlr_session_lock_surface_v1 *wlr_session_lock_surface_v1_try_from_wlr_sur
uint32_t wlr_session_lock_surface_v1_configure(
struct wlr_session_lock_surface_v1 *lock_surface,
uint32_t width, uint32_t height) {
struct wlr_session_lock_surface_v1_configure *configure =
calloc(1, sizeof(struct wlr_session_lock_surface_v1_configure));
struct wlr_session_lock_surface_v1_configure *configure = calloc(1, sizeof(*configure));
if (configure == NULL) {
wl_resource_post_no_memory(lock_surface->resource);
return lock_surface->pending.configure_serial;
@ -258,8 +257,7 @@ static void lock_handle_get_lock_surface(struct wl_client *client,
return;
}
struct wlr_session_lock_surface_v1 *lock_surface =
calloc(1, sizeof(struct wlr_session_lock_surface_v1));
struct wlr_session_lock_surface_v1 *lock_surface = calloc(1, sizeof(*lock_surface));
if (lock_surface == NULL) {
wl_client_post_no_memory(client);
return;
@ -380,8 +378,7 @@ static void lock_manager_handle_lock(struct wl_client *client,
struct wlr_session_lock_manager_v1 *lock_manager =
lock_manager_from_resource(manager_resource);
struct wlr_session_lock_v1 *lock =
calloc(1, sizeof(struct wlr_session_lock_v1));
struct wlr_session_lock_v1 *lock = calloc(1, sizeof(*lock));
if (lock == NULL) {
wl_client_post_no_memory(client);
return;
@ -441,8 +438,7 @@ static void handle_display_destroy(struct wl_listener *listener, void *data) {
}
struct wlr_session_lock_manager_v1 *wlr_session_lock_manager_v1_create(struct wl_display *display) {
struct wlr_session_lock_manager_v1 *lock_manager =
calloc(1, sizeof(struct wlr_session_lock_manager_v1));
struct wlr_session_lock_manager_v1 *lock_manager = calloc(1, sizeof(*lock_manager));
if (lock_manager == NULL) {
return NULL;
}

View file

@ -313,7 +313,7 @@ static void subcompositor_handle_get_subsurface(struct wl_client *client,
struct wlr_surface *surface = wlr_surface_from_resource(surface_resource);
struct wlr_surface *parent = wlr_surface_from_resource(parent_resource);
struct wlr_subsurface *subsurface = calloc(1, sizeof(struct wlr_subsurface));
struct wlr_subsurface *subsurface = calloc(1, sizeof(*subsurface));
if (!subsurface) {
wl_client_post_no_memory(client);
return;
@ -394,8 +394,7 @@ static void subcompositor_handle_display_destroy(
}
struct wlr_subcompositor *wlr_subcompositor_create(struct wl_display *display) {
struct wlr_subcompositor *subcompositor =
calloc(1, sizeof(*subcompositor));
struct wlr_subcompositor *subcompositor = calloc(1, sizeof(*subcompositor));
if (!subcompositor) {
return NULL;
}

View file

@ -92,8 +92,7 @@ static void tearing_control_manager_handle_get_tearing_control(
return;
}
struct wlr_tearing_control_v1 *hint = calloc(1, sizeof(struct wlr_tearing_control_v1));
struct wlr_tearing_control_v1 *hint = calloc(1, sizeof(*hint));
if (!hint) {
wl_client_post_no_memory(client);
return;
@ -163,8 +162,7 @@ struct wlr_tearing_control_manager_v1 *wlr_tearing_control_manager_v1_create(
struct wl_display *display, uint32_t version) {
assert(version <= TEARING_CONTROL_MANAGER_VERSION);
struct wlr_tearing_control_manager_v1 *manager =
calloc(1, sizeof(struct wlr_tearing_control_manager_v1));
struct wlr_tearing_control_manager_v1 *manager = calloc(1, sizeof(*manager));
if (!manager) {
wlr_log_errno(WLR_ERROR, "Allocation failed");
return NULL;

View file

@ -254,8 +254,7 @@ static void text_input_manager_get_text_input(struct wl_client *client,
return;
}
struct wlr_text_input_v3 *text_input =
calloc(1, sizeof(struct wlr_text_input_v3));
struct wlr_text_input_v3 *text_input = calloc(1, sizeof(*text_input));
if (text_input == NULL) {
wl_client_post_no_memory(client);
return;
@ -318,8 +317,7 @@ static void handle_display_destroy(struct wl_listener *listener, void *data) {
struct wlr_text_input_manager_v3 *wlr_text_input_manager_v3_create(
struct wl_display *display) {
struct wlr_text_input_manager_v3 *manager =
calloc(1, sizeof(struct wlr_text_input_manager_v3));
struct wlr_text_input_manager_v3 *manager = calloc(1, sizeof(*manager));
if (!manager) {
return NULL;
}

View file

@ -169,8 +169,7 @@ static void virtual_keyboard_manager_create_virtual_keyboard(
return;
}
struct wlr_virtual_keyboard_v1 *virtual_keyboard = calloc(1,
sizeof(struct wlr_virtual_keyboard_v1));
struct wlr_virtual_keyboard_v1 *virtual_keyboard = calloc(1, sizeof(*virtual_keyboard));
if (!virtual_keyboard) {
wl_client_post_no_memory(client);
return;
@ -219,8 +218,7 @@ static void handle_display_destroy(struct wl_listener *listener, void *data) {
struct wlr_virtual_keyboard_manager_v1*
wlr_virtual_keyboard_manager_v1_create(
struct wl_display *display) {
struct wlr_virtual_keyboard_manager_v1 *manager = calloc(1,
sizeof(struct wlr_virtual_keyboard_manager_v1));
struct wlr_virtual_keyboard_manager_v1 *manager = calloc(1, sizeof(*manager));
if (!manager) {
return NULL;
}

View file

@ -230,8 +230,7 @@ static void virtual_pointer_manager_create_virtual_pointer_with_output(
uint32_t id) {
struct wlr_virtual_pointer_manager_v1 *manager = manager_from_resource(resource);
struct wlr_virtual_pointer_v1 *virtual_pointer = calloc(1,
sizeof(struct wlr_virtual_pointer_v1));
struct wlr_virtual_pointer_v1 *virtual_pointer = calloc(1, sizeof(*virtual_pointer));
if (!virtual_pointer) {
wl_client_post_no_memory(client);
return;
@ -321,8 +320,7 @@ static void handle_display_destroy(struct wl_listener *listener, void *data) {
struct wlr_virtual_pointer_manager_v1* wlr_virtual_pointer_manager_v1_create(
struct wl_display *display) {
struct wlr_virtual_pointer_manager_v1 *manager = calloc(1,
sizeof(struct wlr_virtual_pointer_manager_v1));
struct wlr_virtual_pointer_manager_v1 *manager = calloc(1, sizeof(*manager));
if (!manager) {
return NULL;
}

View file

@ -5,8 +5,7 @@
struct wlr_xcursor_manager *wlr_xcursor_manager_create(const char *name,
uint32_t size) {
struct wlr_xcursor_manager *manager =
calloc(1, sizeof(struct wlr_xcursor_manager));
struct wlr_xcursor_manager *manager = calloc(1, sizeof(*manager));
if (manager == NULL) {
return NULL;
}
@ -41,7 +40,7 @@ bool wlr_xcursor_manager_load(struct wlr_xcursor_manager *manager,
}
}
theme = calloc(1, sizeof(struct wlr_xcursor_manager_theme));
theme = calloc(1, sizeof(*theme));
if (theme == NULL) {
return false;
}

View file

@ -96,8 +96,7 @@ static void toplevel_decoration_handle_surface_configure(
return;
}
struct wlr_xdg_toplevel_decoration_v1_configure *configure =
calloc(1, sizeof(struct wlr_xdg_toplevel_decoration_v1_configure));
struct wlr_xdg_toplevel_decoration_v1_configure *configure = calloc(1, sizeof(*configure));
if (configure == NULL) {
return;
}
@ -197,8 +196,7 @@ static void decoration_manager_handle_get_toplevel_decoration(
}
}
struct wlr_xdg_toplevel_decoration_v1 *decoration =
calloc(1, sizeof(struct wlr_xdg_toplevel_decoration_v1));
struct wlr_xdg_toplevel_decoration_v1 *decoration = calloc(1, sizeof(*decoration));
if (decoration == NULL) {
wl_client_post_no_memory(client);
return;
@ -282,8 +280,7 @@ static void handle_display_destroy(struct wl_listener *listener, void *data) {
struct wlr_xdg_decoration_manager_v1 *
wlr_xdg_decoration_manager_v1_create(struct wl_display *display) {
struct wlr_xdg_decoration_manager_v1 *manager =
calloc(1, sizeof(struct wlr_xdg_decoration_manager_v1));
struct wlr_xdg_decoration_manager_v1 *manager = calloc(1, sizeof(*manager));
if (manager == NULL) {
return NULL;
}

View file

@ -92,7 +92,7 @@ static void xdg_imported_handle_set_parent_of(struct wl_client *client,
}
}
child = calloc(1, sizeof(struct wlr_xdg_imported_child_v1));
child = calloc(1, sizeof(*child));
if (child == NULL) {
wl_client_post_no_memory(client);
return;
@ -211,8 +211,7 @@ static void xdg_exporter_handle_export(struct wl_client *wl_client,
return;
}
struct wlr_xdg_exported_v1 *exported =
calloc(1, sizeof(struct wlr_xdg_exported_v1));
struct wlr_xdg_exported_v1 *exported = calloc(1, sizeof(*exported));
if (exported == NULL) {
wl_client_post_no_memory(wl_client);
return;
@ -302,8 +301,7 @@ static void xdg_importer_handle_import(struct wl_client *wl_client,
struct wlr_xdg_foreign_v1 *foreign =
xdg_foreign_from_importer_resource(client_resource);
struct wlr_xdg_imported_v1 *imported =
calloc(1, sizeof(struct wlr_xdg_imported_v1));
struct wlr_xdg_imported_v1 *imported = calloc(1, sizeof(*imported));
if (imported == NULL) {
wl_client_post_no_memory(wl_client);
return;
@ -386,8 +384,7 @@ static void handle_foreign_registry_destroy(struct wl_listener *listener,
struct wlr_xdg_foreign_v1 *wlr_xdg_foreign_v1_create(
struct wl_display *display, struct wlr_xdg_foreign_registry *registry) {
struct wlr_xdg_foreign_v1 *foreign = calloc(1,
sizeof(struct wlr_xdg_foreign_v1));
struct wlr_xdg_foreign_v1 *foreign = calloc(1, sizeof(*foreign));
if (!foreign) {
return NULL;
}

View file

@ -95,7 +95,7 @@ static void xdg_imported_handle_set_parent_of(struct wl_client *client,
}
}
child = calloc(1, sizeof(struct wlr_xdg_imported_child_v2));
child = calloc(1, sizeof(*child));
if (child == NULL) {
wl_client_post_no_memory(client);
return;
@ -214,8 +214,7 @@ static void xdg_exporter_handle_export(struct wl_client *wl_client,
return;
}
struct wlr_xdg_exported_v2 *exported =
calloc(1, sizeof(struct wlr_xdg_exported_v2));
struct wlr_xdg_exported_v2 *exported = calloc(1, sizeof(*exported));
if (exported == NULL) {
wl_client_post_no_memory(wl_client);
return;
@ -305,8 +304,7 @@ static void xdg_importer_handle_import(struct wl_client *wl_client,
struct wlr_xdg_foreign_v2 *foreign =
xdg_foreign_from_importer_resource(client_resource);
struct wlr_xdg_imported_v2 *imported =
calloc(1, sizeof(struct wlr_xdg_imported_v2));
struct wlr_xdg_imported_v2 *imported = calloc(1, sizeof(*imported));
if (imported == NULL) {
wl_client_post_no_memory(wl_client);
return;
@ -389,8 +387,7 @@ static void handle_foreign_registry_destroy(struct wl_listener *listener,
struct wlr_xdg_foreign_v2 *wlr_xdg_foreign_v2_create(
struct wl_display *display, struct wlr_xdg_foreign_registry *registry) {
struct wlr_xdg_foreign_v2 *foreign = calloc(1,
sizeof(struct wlr_xdg_foreign_v2));
struct wlr_xdg_foreign_v2 *foreign = calloc(1, sizeof(*foreign));
if (!foreign) {
return NULL;
}

View file

@ -192,7 +192,7 @@ static void handle_output_description(struct wl_listener *listener,
static void add_output(struct wlr_xdg_output_manager_v1 *manager,
struct wlr_output_layout_output *layout_output) {
struct wlr_xdg_output_v1 *output = calloc(1, sizeof(struct wlr_xdg_output_v1));
struct wlr_xdg_output_v1 *output = calloc(1, sizeof(*output));
if (output == NULL) {
return;
}
@ -256,8 +256,7 @@ static void handle_display_destroy(struct wl_listener *listener, void *data) {
struct wlr_xdg_output_manager_v1 *wlr_xdg_output_manager_v1_create(
struct wl_display *display, struct wlr_output_layout *layout) {
struct wlr_xdg_output_manager_v1 *manager =
calloc(1, sizeof(struct wlr_xdg_output_manager_v1));
struct wlr_xdg_output_manager_v1 *manager = calloc(1, sizeof(*manager));
if (manager == NULL) {
return NULL;
}

View file

@ -12,8 +12,7 @@ void handle_xdg_popup_ack_configure(
struct wlr_xdg_popup_configure *send_xdg_popup_configure(
struct wlr_xdg_popup *popup) {
struct wlr_xdg_popup_configure *configure =
calloc(1, sizeof(*configure));
struct wlr_xdg_popup_configure *configure = calloc(1, sizeof(*configure));
if (configure == NULL) {
wl_resource_post_no_memory(popup->resource);
return NULL;
@ -214,7 +213,7 @@ static struct wlr_xdg_popup_grab *get_xdg_shell_popup_grab_from_seat(
}
}
xdg_grab = calloc(1, sizeof(struct wlr_xdg_popup_grab));
xdg_grab = calloc(1, sizeof(*xdg_grab));
if (!xdg_grab) {
return NULL;
}
@ -382,7 +381,7 @@ void create_xdg_popup(struct wlr_xdg_surface *surface,
}
assert(surface->popup == NULL);
surface->popup = calloc(1, sizeof(struct wlr_xdg_popup));
surface->popup = calloc(1, sizeof(*surface->popup));
if (!surface->popup) {
wl_resource_post_no_memory(surface->resource);
return;

View file

@ -95,8 +95,7 @@ static void xdg_shell_bind(struct wl_client *wl_client, void *data,
struct wlr_xdg_shell *xdg_shell = data;
assert(wl_client && xdg_shell);
struct wlr_xdg_client *client =
calloc(1, sizeof(struct wlr_xdg_client));
struct wlr_xdg_client *client = calloc(1, sizeof(*client));
if (client == NULL) {
wl_client_post_no_memory(wl_client);
return;
@ -140,8 +139,7 @@ struct wlr_xdg_shell *wlr_xdg_shell_create(struct wl_display *display,
uint32_t version) {
assert(version <= WM_BASE_VERSION);
struct wlr_xdg_shell *xdg_shell =
calloc(1, sizeof(struct wlr_xdg_shell));
struct wlr_xdg_shell *xdg_shell = calloc(1, sizeof(*xdg_shell));
if (!xdg_shell) {
return NULL;
}

View file

@ -129,8 +129,7 @@ static void surface_send_configure(void *user_data) {
surface->configure_idle = NULL;
struct wlr_xdg_surface_configure *configure =
calloc(1, sizeof(struct wlr_xdg_surface_configure));
struct wlr_xdg_surface_configure *configure = calloc(1, sizeof(*configure));
if (configure == NULL) {
wl_client_post_no_memory(surface->client->client);
return;
@ -352,8 +351,7 @@ void create_xdg_surface(struct wlr_xdg_client *client, struct wlr_surface *wlr_s
return;
}
struct wlr_xdg_surface *surface =
calloc(1, sizeof(struct wlr_xdg_surface));
struct wlr_xdg_surface *surface = calloc(1, sizeof(*surface));
if (surface == NULL) {
wl_client_post_no_memory(client->client);
return;

View file

@ -475,7 +475,7 @@ void create_xdg_toplevel(struct wlr_xdg_surface *surface,
}
assert(surface->toplevel == NULL);
surface->toplevel = calloc(1, sizeof(struct wlr_xdg_toplevel));
surface->toplevel = calloc(1, sizeof(*surface->toplevel));
if (surface->toplevel == NULL) {
wl_resource_post_no_memory(surface->resource);
return;