mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-04 20:55:58 +01: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
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -101,7 +101,7 @@ static void server_handle_new_output(struct wl_listener *listener, void *data) {
|
|||
|
||||
wlr_output_init_render(wlr_output, server->allocator, server->renderer);
|
||||
|
||||
struct output *output = calloc(1, sizeof(struct output));
|
||||
struct output *output = calloc(1, sizeof(*output));
|
||||
output->wlr = wlr_output;
|
||||
output->server = server;
|
||||
output->frame.notify = output_handle_frame;
|
||||
|
|
|
@ -252,7 +252,7 @@ static const struct zwlr_foreign_toplevel_handle_v1_listener toplevel_impl = {
|
|||
static void toplevel_manager_handle_toplevel(void *data,
|
||||
struct zwlr_foreign_toplevel_manager_v1 *toplevel_manager,
|
||||
struct zwlr_foreign_toplevel_handle_v1 *zwlr_toplevel) {
|
||||
struct toplevel_v1 *toplevel = calloc(1, sizeof(struct toplevel_v1));
|
||||
struct toplevel_v1 *toplevel = calloc(1, sizeof(*toplevel));
|
||||
if (!toplevel) {
|
||||
fprintf(stderr, "Failed to allocate memory for toplevel\n");
|
||||
return;
|
||||
|
|
|
@ -154,8 +154,7 @@ static void server_handle_new_output(struct wl_listener *listener, void *data) {
|
|||
|
||||
wlr_output_init_render(wlr_output, server->allocator, server->renderer);
|
||||
|
||||
struct fullscreen_output *output =
|
||||
calloc(1, sizeof(struct fullscreen_output));
|
||||
struct fullscreen_output *output = calloc(1, sizeof(*output));
|
||||
output->wlr_output = wlr_output;
|
||||
output->server = server;
|
||||
output->frame.notify = output_handle_frame;
|
||||
|
|
|
@ -87,7 +87,7 @@ static const struct zwlr_gamma_control_v1_listener gamma_control_listener = {
|
|||
static void registry_handle_global(void *data, struct wl_registry *registry,
|
||||
uint32_t name, const char *interface, uint32_t version) {
|
||||
if (strcmp(interface, wl_output_interface.name) == 0) {
|
||||
struct output *output = calloc(1, sizeof(struct output));
|
||||
struct output *output = calloc(1, sizeof(*output));
|
||||
output->wl_output = wl_registry_bind(registry, name,
|
||||
&wl_output_interface, 1);
|
||||
wl_list_insert(&outputs, &output->link);
|
||||
|
|
|
@ -168,7 +168,7 @@ static void new_output_notify(struct wl_listener *listener, void *data) {
|
|||
|
||||
wlr_output_init_render(output, sample->allocator, sample->renderer);
|
||||
|
||||
struct sample_output *sample_output = calloc(1, sizeof(struct sample_output));
|
||||
struct sample_output *sample_output = calloc(1, sizeof(*sample_output));
|
||||
wlr_output_layout_add_auto(sample->layout, output);
|
||||
sample_output->output = output;
|
||||
sample_output->sample = sample;
|
||||
|
@ -236,7 +236,7 @@ static void new_input_notify(struct wl_listener *listener, void *data) {
|
|||
struct sample_state *sample = wl_container_of(listener, sample, new_input);
|
||||
switch (device->type) {
|
||||
case WLR_INPUT_DEVICE_KEYBOARD:;
|
||||
struct sample_keyboard *keyboard = calloc(1, sizeof(struct sample_keyboard));
|
||||
struct sample_keyboard *keyboard = calloc(1, sizeof(*keyboard));
|
||||
keyboard->wlr_keyboard = wlr_keyboard_from_input_device(device);
|
||||
keyboard->sample = sample;
|
||||
wl_signal_add(&device->events.destroy, &keyboard->destroy);
|
||||
|
|
|
@ -49,7 +49,7 @@ static const struct zwlr_output_power_v1_listener output_power_listener = {
|
|||
static void registry_handle_global(void *data, struct wl_registry *registry,
|
||||
uint32_t name, const char *interface, uint32_t version) {
|
||||
if (strcmp(interface, wl_output_interface.name) == 0) {
|
||||
struct output *output = calloc(1, sizeof(struct output));
|
||||
struct output *output = calloc(1, sizeof(*output));
|
||||
output->wl_output = wl_registry_bind(registry, name,
|
||||
&wl_output_interface, 1);
|
||||
wl_list_insert(&outputs, &output->link);
|
||||
|
|
|
@ -194,7 +194,7 @@ static void handle_touch_up(struct wl_listener *listener, void *data) {
|
|||
static void handle_touch_down(struct wl_listener *listener, void *data) {
|
||||
struct sample_state *sample = wl_container_of(listener, sample, touch_down);
|
||||
struct wlr_touch_down_event *event = data;
|
||||
struct touch_point *point = calloc(1, sizeof(struct touch_point));
|
||||
struct touch_point *point = calloc(1, sizeof(*point));
|
||||
point->touch_id = event->touch_id;
|
||||
point->x = event->x;
|
||||
point->y = event->y;
|
||||
|
@ -266,7 +266,7 @@ static void new_output_notify(struct wl_listener *listener, void *data) {
|
|||
|
||||
wlr_output_init_render(output, sample->allocator, sample->renderer);
|
||||
|
||||
struct sample_output *sample_output = calloc(1, sizeof(struct sample_output));
|
||||
struct sample_output *sample_output = calloc(1, sizeof(*sample_output));
|
||||
sample_output->output = output;
|
||||
sample_output->state = sample;
|
||||
wl_signal_add(&output->events.frame, &sample_output->frame);
|
||||
|
@ -305,7 +305,7 @@ static void new_input_notify(struct wl_listener *listener, void *data) {
|
|||
break;
|
||||
|
||||
case WLR_INPUT_DEVICE_KEYBOARD:;
|
||||
struct sample_keyboard *keyboard = calloc(1, sizeof(struct sample_keyboard));
|
||||
struct sample_keyboard *keyboard = calloc(1, sizeof(*keyboard));
|
||||
keyboard->wlr_keyboard = wlr_keyboard_from_input_device(device);
|
||||
keyboard->state = state;
|
||||
wl_signal_add(&device->events.destroy, &keyboard->destroy);
|
||||
|
|
|
@ -437,7 +437,7 @@ int main(int argc, char **argv) {
|
|||
|
||||
/* Initialize EGL context */
|
||||
|
||||
struct egl_info *e = calloc(1, sizeof(struct egl_info));
|
||||
struct egl_info *e = calloc(1, sizeof(*e));
|
||||
e->width = e->height = 512;
|
||||
|
||||
egl_init(display);
|
||||
|
@ -465,7 +465,7 @@ int main(int argc, char **argv) {
|
|||
|
||||
/* Setup global state and render */
|
||||
|
||||
struct window *w = calloc(1, sizeof(struct window));
|
||||
struct window *w = calloc(1, sizeof(*w));
|
||||
w->egl_info = e;
|
||||
|
||||
draw_init(e);
|
||||
|
|
|
@ -119,7 +119,7 @@ static void new_output_notify(struct wl_listener *listener, void *data) {
|
|||
|
||||
wlr_output_init_render(output, sample->allocator, sample->renderer);
|
||||
|
||||
struct sample_output *sample_output = calloc(1, sizeof(struct sample_output));
|
||||
struct sample_output *sample_output = calloc(1, sizeof(*sample_output));
|
||||
sample_output->x_offs = sample_output->y_offs = 0;
|
||||
sample_output->x_vel = sample_output->y_vel = 128;
|
||||
|
||||
|
@ -187,7 +187,7 @@ static void new_input_notify(struct wl_listener *listener, void *data) {
|
|||
struct sample_state *sample = wl_container_of(listener, sample, new_input);
|
||||
switch (device->type) {
|
||||
case WLR_INPUT_DEVICE_KEYBOARD:;
|
||||
struct sample_keyboard *keyboard = calloc(1, sizeof(struct sample_keyboard));
|
||||
struct sample_keyboard *keyboard = calloc(1, sizeof(*keyboard));
|
||||
keyboard->wlr_keyboard = wlr_keyboard_from_input_device(device);
|
||||
keyboard->sample = sample;
|
||||
wl_signal_add(&device->events.destroy, &keyboard->destroy);
|
||||
|
|
|
@ -72,8 +72,7 @@ static void server_handle_new_output(struct wl_listener *listener, void *data) {
|
|||
|
||||
wlr_output_init_render(wlr_output, server->allocator, server->renderer);
|
||||
|
||||
struct output *output =
|
||||
calloc(1, sizeof(struct output));
|
||||
struct output *output = calloc(1, sizeof(*output));
|
||||
output->wlr = wlr_output;
|
||||
output->server = server;
|
||||
output->frame.notify = output_handle_frame;
|
||||
|
@ -118,7 +117,7 @@ static void server_handle_new_surface(struct wl_listener *listener,
|
|||
int pos = server->surface_offset;
|
||||
server->surface_offset += 50;
|
||||
|
||||
struct surface *surface = calloc(1, sizeof(struct surface));
|
||||
struct surface *surface = calloc(1, sizeof(*surface));
|
||||
surface->wlr = wlr_surface;
|
||||
surface->commit.notify = surface_handle_commit;
|
||||
wl_signal_add(&wlr_surface->events.commit, &surface->commit);
|
||||
|
|
|
@ -97,8 +97,7 @@ static void new_output_notify(struct wl_listener *listener, void *data) {
|
|||
|
||||
wlr_output_init_render(output, sample->allocator, sample->renderer);
|
||||
|
||||
struct sample_output *sample_output =
|
||||
calloc(1, sizeof(struct sample_output));
|
||||
struct sample_output *sample_output = calloc(1, sizeof(*sample_output));
|
||||
sample_output->output = output;
|
||||
sample_output->sample = sample;
|
||||
wl_signal_add(&output->events.frame, &sample_output->frame);
|
||||
|
@ -146,8 +145,7 @@ static void new_input_notify(struct wl_listener *listener, void *data) {
|
|||
struct sample_state *sample = wl_container_of(listener, sample, new_input);
|
||||
switch (device->type) {
|
||||
case WLR_INPUT_DEVICE_KEYBOARD:;
|
||||
struct sample_keyboard *keyboard =
|
||||
calloc(1, sizeof(struct sample_keyboard));
|
||||
struct sample_keyboard *keyboard = calloc(1, sizeof(*keyboard));
|
||||
keyboard->wlr_keyboard = wlr_keyboard_from_input_device(device);
|
||||
keyboard->sample = sample;
|
||||
wl_signal_add(&device->events.destroy, &keyboard->destroy);
|
||||
|
|
|
@ -270,7 +270,7 @@ static void new_output_notify(struct wl_listener *listener, void *data) {
|
|||
|
||||
wlr_output_init_render(output, sample->allocator, sample->renderer);
|
||||
|
||||
struct sample_output *sample_output = calloc(1, sizeof(struct sample_output));
|
||||
struct sample_output *sample_output = calloc(1, sizeof(*sample_output));
|
||||
sample_output->output = output;
|
||||
sample_output->sample = sample;
|
||||
wl_signal_add(&output->events.frame, &sample_output->frame);
|
||||
|
@ -317,7 +317,7 @@ static void new_input_notify(struct wl_listener *listener, void *data) {
|
|||
struct sample_state *sample = wl_container_of(listener, sample, new_input);
|
||||
switch (device->type) {
|
||||
case WLR_INPUT_DEVICE_KEYBOARD:;
|
||||
struct sample_keyboard *keyboard = calloc(1, sizeof(struct sample_keyboard));
|
||||
struct sample_keyboard *keyboard = calloc(1, sizeof(*keyboard));
|
||||
keyboard->wlr_keyboard = wlr_keyboard_from_input_device(device);
|
||||
keyboard->sample = sample;
|
||||
wl_signal_add(&device->events.destroy, &keyboard->destroy);
|
||||
|
@ -340,7 +340,7 @@ static void new_input_notify(struct wl_listener *listener, void *data) {
|
|||
xkb_context_unref(context);
|
||||
break;
|
||||
case WLR_INPUT_DEVICE_TABLET_PAD:;
|
||||
struct tablet_pad_state *pstate = calloc(sizeof(struct tablet_pad_state), 1);
|
||||
struct tablet_pad_state *pstate = calloc(1, sizeof(*pstate));
|
||||
pstate->wlr_tablet_pad = wlr_tablet_pad_from_input_device(device);
|
||||
pstate->sample = sample;
|
||||
pstate->destroy.notify = tablet_pad_destroy_notify;
|
||||
|
@ -358,7 +358,7 @@ static void new_input_notify(struct wl_listener *listener, void *data) {
|
|||
sample->height_mm = tablet->height_mm == 0 ?
|
||||
10 : tablet->height_mm;
|
||||
|
||||
struct tablet_tool_state *tstate = calloc(sizeof(struct tablet_tool_state), 1);
|
||||
struct tablet_tool_state *tstate = calloc(1, sizeof(*tstate));
|
||||
tstate->wlr_tablet = tablet;
|
||||
tstate->sample = sample;
|
||||
tstate->destroy.notify = tablet_tool_destroy_notify;
|
||||
|
|
|
@ -121,7 +121,7 @@ static void show_status(void) {
|
|||
for (unsigned i = 0; i < utf8_strlen(buffer); i++) {
|
||||
printf(" ");
|
||||
}
|
||||
char *cursor_mark = calloc(utf8_strlen(preedit_text) + 2, sizeof(char));
|
||||
char *cursor_mark = calloc(utf8_strlen(preedit_text) + 2, sizeof(*cursor_mark));
|
||||
for (unsigned i = 0; i < utf8_strlen(preedit_text); i++) {
|
||||
cursor_mark[i] = '.';
|
||||
}
|
||||
|
@ -249,7 +249,7 @@ static void text_input_handle_done(void *data,
|
|||
commit_string = "";
|
||||
}
|
||||
size_t new_size = strlen(buffer) + strlen(commit_string) + 1;
|
||||
char *new_buffer = calloc(new_size, sizeof(char)); // realloc may fail anyway
|
||||
char *new_buffer = calloc(new_size, sizeof(*new_buffer)); // realloc may fail anyway
|
||||
snprintf(new_buffer, new_size, "%s%s", buffer, commit_string);
|
||||
free(buffer);
|
||||
buffer = new_buffer;
|
||||
|
@ -333,7 +333,7 @@ int main(int argc, char **argv) {
|
|||
}
|
||||
}
|
||||
|
||||
buffer = calloc(1, sizeof(char));
|
||||
buffer = calloc(1, sizeof(*buffer));
|
||||
|
||||
display = wl_display_connect(NULL);
|
||||
if (display == NULL) {
|
||||
|
|
|
@ -104,7 +104,7 @@ static void touch_down_notify(struct wl_listener *listener, void *data) {
|
|||
struct wlr_touch_down_event *event = data;
|
||||
struct touch_state *tstate = wl_container_of(listener, tstate, down);
|
||||
struct sample_state *sample = tstate->sample;
|
||||
struct touch_point *point = calloc(1, sizeof(struct touch_point));
|
||||
struct touch_point *point = calloc(1, sizeof(*point));
|
||||
point->touch_id = event->touch_id;
|
||||
point->x = event->x;
|
||||
point->y = event->y;
|
||||
|
@ -175,7 +175,7 @@ static void new_output_notify(struct wl_listener *listener, void *data) {
|
|||
|
||||
wlr_output_init_render(output, sample->allocator, sample->renderer);
|
||||
|
||||
struct sample_output *sample_output = calloc(1, sizeof(struct sample_output));
|
||||
struct sample_output *sample_output = calloc(1, sizeof(*sample_output));
|
||||
sample_output->output = output;
|
||||
sample_output->sample = sample;
|
||||
wl_signal_add(&output->events.frame, &sample_output->frame);
|
||||
|
@ -222,7 +222,7 @@ static void new_input_notify(struct wl_listener *listener, void *data) {
|
|||
struct sample_state *sample = wl_container_of(listener, sample, new_input);
|
||||
switch (device->type) {
|
||||
case WLR_INPUT_DEVICE_KEYBOARD:;
|
||||
struct sample_keyboard *keyboard = calloc(1, sizeof(struct sample_keyboard));
|
||||
struct sample_keyboard *keyboard = calloc(1, sizeof(*keyboard));
|
||||
keyboard->wlr_keyboard = wlr_keyboard_from_input_device(device);
|
||||
keyboard->sample = sample;
|
||||
wl_signal_add(&device->events.destroy, &keyboard->destroy);
|
||||
|
@ -245,7 +245,7 @@ static void new_input_notify(struct wl_listener *listener, void *data) {
|
|||
xkb_context_unref(context);
|
||||
break;
|
||||
case WLR_INPUT_DEVICE_TOUCH:;
|
||||
struct touch_state *tstate = calloc(sizeof(struct touch_state), 1);
|
||||
struct touch_state *tstate = calloc(1, sizeof(*tstate));
|
||||
tstate->wlr_touch = wlr_touch_from_input_device(device);
|
||||
tstate->sample = sample;
|
||||
tstate->destroy.notify = touch_destroy_notify;
|
||||
|
|
14
render/egl.c
14
render/egl.c
|
@ -210,7 +210,7 @@ static struct wlr_egl *egl_create(void) {
|
|||
return NULL;
|
||||
}
|
||||
|
||||
struct wlr_egl *egl = calloc(1, sizeof(struct wlr_egl));
|
||||
struct wlr_egl *egl = calloc(1, sizeof(*egl));
|
||||
if (egl == NULL) {
|
||||
wlr_log_errno(WLR_ERROR, "Allocation failed");
|
||||
return NULL;
|
||||
|
@ -457,7 +457,7 @@ static EGLDeviceEXT get_egl_device_from_drm_fd(struct wlr_egl *egl,
|
|||
return EGL_NO_DEVICE_EXT;
|
||||
}
|
||||
|
||||
EGLDeviceEXT *devices = calloc(nb_devices, sizeof(EGLDeviceEXT));
|
||||
EGLDeviceEXT *devices = calloc(nb_devices, sizeof(*devices));
|
||||
if (devices == NULL) {
|
||||
wlr_log_errno(WLR_ERROR, "Failed to allocate EGL device list");
|
||||
return EGL_NO_DEVICE_EXT;
|
||||
|
@ -807,7 +807,7 @@ static int get_egl_dmabuf_formats(struct wlr_egl *egl, EGLint **formats) {
|
|||
};
|
||||
int num = sizeof(fallback_formats) / sizeof(fallback_formats[0]);
|
||||
|
||||
*formats = calloc(num, sizeof(EGLint));
|
||||
*formats = calloc(num, sizeof(**formats));
|
||||
if (!*formats) {
|
||||
wlr_log_errno(WLR_ERROR, "Allocation failed");
|
||||
return -1;
|
||||
|
@ -823,7 +823,7 @@ static int get_egl_dmabuf_formats(struct wlr_egl *egl, EGLint **formats) {
|
|||
return -1;
|
||||
}
|
||||
|
||||
*formats = calloc(num, sizeof(EGLint));
|
||||
*formats = calloc(num, sizeof(**formats));
|
||||
if (*formats == NULL) {
|
||||
wlr_log(WLR_ERROR, "Allocation failed: %s", strerror(errno));
|
||||
return -1;
|
||||
|
@ -860,12 +860,12 @@ static int get_egl_dmabuf_modifiers(struct wlr_egl *egl, EGLint format,
|
|||
return 0;
|
||||
}
|
||||
|
||||
*modifiers = calloc(num, sizeof(uint64_t));
|
||||
*modifiers = calloc(num, sizeof(**modifiers));
|
||||
if (*modifiers == NULL) {
|
||||
wlr_log_errno(WLR_ERROR, "Allocation failed");
|
||||
return -1;
|
||||
}
|
||||
*external_only = calloc(num, sizeof(EGLBoolean));
|
||||
*external_only = calloc(num, sizeof(**external_only));
|
||||
if (*external_only == NULL) {
|
||||
wlr_log_errno(WLR_ERROR, "Allocation failed");
|
||||
free(*modifiers);
|
||||
|
@ -912,7 +912,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;
|
||||
|
|
|
@ -583,7 +583,7 @@ static struct wlr_render_timer *gles2_render_timer_create(struct wlr_renderer *w
|
|||
return NULL;
|
||||
}
|
||||
|
||||
struct wlr_gles2_render_timer *timer = calloc(1, sizeof(struct wlr_gles2_render_timer));
|
||||
struct wlr_gles2_render_timer *timer = calloc(1, sizeof(*timer));
|
||||
if (!timer) {
|
||||
return NULL;
|
||||
}
|
||||
|
@ -826,8 +826,7 @@ struct wlr_renderer *wlr_gles2_renderer_create(struct wlr_egl *egl) {
|
|||
return NULL;
|
||||
}
|
||||
|
||||
struct wlr_gles2_renderer *renderer =
|
||||
calloc(1, sizeof(struct wlr_gles2_renderer));
|
||||
struct wlr_gles2_renderer *renderer = calloc(1, sizeof(*renderer));
|
||||
if (renderer == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
@ -174,8 +174,7 @@ static const struct wlr_texture_impl texture_impl = {
|
|||
|
||||
static struct wlr_gles2_texture *gles2_texture_create(
|
||||
struct wlr_gles2_renderer *renderer, uint32_t width, uint32_t height) {
|
||||
struct wlr_gles2_texture *texture =
|
||||
calloc(1, sizeof(struct wlr_gles2_texture));
|
||||
struct wlr_gles2_texture *texture = calloc(1, sizeof(*texture));
|
||||
if (texture == NULL) {
|
||||
wlr_log_errno(WLR_ERROR, "Allocation failed");
|
||||
return NULL;
|
||||
|
|
|
@ -341,8 +341,7 @@ static const struct wlr_drm_format_set *pixman_get_render_formats(
|
|||
static struct wlr_pixman_texture *pixman_texture_create(
|
||||
struct wlr_pixman_renderer *renderer, uint32_t drm_format,
|
||||
uint32_t width, uint32_t height) {
|
||||
struct wlr_pixman_texture *texture =
|
||||
calloc(1, sizeof(struct wlr_pixman_texture));
|
||||
struct wlr_pixman_texture *texture = calloc(1, sizeof(*texture));
|
||||
if (texture == NULL) {
|
||||
wlr_log_errno(WLR_ERROR, "Failed to allocate pixman texture");
|
||||
return NULL;
|
||||
|
@ -530,8 +529,7 @@ static const struct wlr_renderer_impl renderer_impl = {
|
|||
};
|
||||
|
||||
struct wlr_renderer *wlr_pixman_renderer_create(void) {
|
||||
struct wlr_pixman_renderer *renderer =
|
||||
calloc(1, sizeof(struct wlr_pixman_renderer));
|
||||
struct wlr_pixman_renderer *renderer = calloc(1, sizeof(*renderer));
|
||||
if (renderer == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
@ -118,9 +118,9 @@ static bool render_pass_submit(struct wlr_render_pass *wlr_pass) {
|
|||
|
||||
// insert acquire and release barriers for dmabuf-images
|
||||
uint32_t barrier_count = wl_list_length(&renderer->foreign_textures) + 1;
|
||||
VkImageMemoryBarrier *acquire_barriers = calloc(barrier_count, sizeof(VkImageMemoryBarrier));
|
||||
VkImageMemoryBarrier *release_barriers = calloc(barrier_count, sizeof(VkImageMemoryBarrier));
|
||||
render_wait = calloc(barrier_count * WLR_DMABUF_MAX_PLANES, sizeof(VkSemaphoreSubmitInfoKHR));
|
||||
VkImageMemoryBarrier *acquire_barriers = calloc(barrier_count, sizeof(*acquire_barriers));
|
||||
VkImageMemoryBarrier *release_barriers = calloc(barrier_count, sizeof(*release_barriers));
|
||||
render_wait = calloc(barrier_count * WLR_DMABUF_MAX_PLANES, sizeof(*render_wait));
|
||||
if (acquire_barriers == NULL || release_barriers == NULL || render_wait == NULL) {
|
||||
wlr_log_errno(WLR_ERROR, "Allocation failed");
|
||||
free(acquire_barriers);
|
||||
|
|
|
@ -1117,9 +1117,9 @@ static void vulkan_end(struct wlr_renderer *wlr_renderer) {
|
|||
|
||||
// insert acquire and release barriers for dmabuf-images
|
||||
unsigned barrier_count = wl_list_length(&renderer->foreign_textures) + 1;
|
||||
VkImageMemoryBarrier *acquire_barriers = calloc(barrier_count, sizeof(VkImageMemoryBarrier));
|
||||
VkImageMemoryBarrier *release_barriers = calloc(barrier_count, sizeof(VkImageMemoryBarrier));
|
||||
VkSemaphoreSubmitInfoKHR *render_wait = calloc(barrier_count * WLR_DMABUF_MAX_PLANES, sizeof(VkSemaphoreSubmitInfoKHR));
|
||||
VkImageMemoryBarrier *acquire_barriers = calloc(barrier_count, sizeof(*acquire_barriers));
|
||||
VkImageMemoryBarrier *release_barriers = calloc(barrier_count, sizeof(*release_barriers));
|
||||
VkSemaphoreSubmitInfoKHR *render_wait = calloc(barrier_count * WLR_DMABUF_MAX_PLANES, sizeof(*render_wait));
|
||||
if (acquire_barriers == NULL || release_barriers == NULL || render_wait == NULL) {
|
||||
wlr_log_errno(WLR_ERROR, "Allocation failed");
|
||||
free(acquire_barriers);
|
||||
|
|
|
@ -256,8 +256,7 @@ static const struct wlr_texture_impl texture_impl = {
|
|||
|
||||
static struct wlr_vk_texture *vulkan_texture_create(
|
||||
struct wlr_vk_renderer *renderer, uint32_t width, uint32_t height) {
|
||||
struct wlr_vk_texture *texture =
|
||||
calloc(1, sizeof(struct wlr_vk_texture));
|
||||
struct wlr_vk_texture *texture = calloc(1, sizeof(*texture));
|
||||
if (texture == NULL) {
|
||||
wlr_log_errno(WLR_ERROR, "Allocation failed");
|
||||
return NULL;
|
||||
|
|
|
@ -252,7 +252,7 @@ static int open_drm_render_node(void) {
|
|||
wlr_log(WLR_ERROR, "drmGetDevices2 failed: %s", strerror(-devices_len));
|
||||
return -1;
|
||||
}
|
||||
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 -1;
|
||||
|
|
|
@ -243,8 +243,7 @@ static void server_new_keyboard(struct tinywl_server *server,
|
|||
struct wlr_input_device *device) {
|
||||
struct wlr_keyboard *wlr_keyboard = wlr_keyboard_from_input_device(device);
|
||||
|
||||
struct tinywl_keyboard *keyboard =
|
||||
calloc(1, sizeof(struct tinywl_keyboard));
|
||||
struct tinywl_keyboard *keyboard = calloc(1, sizeof(*keyboard));
|
||||
keyboard->server = server;
|
||||
keyboard->wlr_keyboard = wlr_keyboard;
|
||||
|
||||
|
@ -619,8 +618,7 @@ static void server_new_output(struct wl_listener *listener, void *data) {
|
|||
wlr_output_state_finish(&state);
|
||||
|
||||
/* Allocates and configures our state for this output */
|
||||
struct tinywl_output *output =
|
||||
calloc(1, sizeof(struct tinywl_output));
|
||||
struct tinywl_output *output = calloc(1, sizeof(*output));
|
||||
output->wlr_output = wlr_output;
|
||||
output->server = server;
|
||||
|
||||
|
@ -794,8 +792,7 @@ static void server_new_xdg_surface(struct wl_listener *listener, void *data) {
|
|||
assert(xdg_surface->role == WLR_XDG_SURFACE_ROLE_TOPLEVEL);
|
||||
|
||||
/* Allocate a tinywl_view for this surface */
|
||||
struct tinywl_view *view =
|
||||
calloc(1, sizeof(struct tinywl_view));
|
||||
struct tinywl_view *view = calloc(1, sizeof(*view));
|
||||
view->server = server;
|
||||
view->xdg_toplevel = xdg_surface->toplevel;
|
||||
view->scene_tree = wlr_scene_xdg_surface_create(
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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(¤t_damage->region);
|
||||
pixman_region32_copy(¤t_damage->region,
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -149,7 +149,7 @@ xcursor_image_create(int width, int height)
|
|||
if (width > XCURSOR_IMAGE_MAX_SIZE || height > XCURSOR_IMAGE_MAX_SIZE)
|
||||
return NULL;
|
||||
|
||||
image = malloc(sizeof(struct xcursor_image) +
|
||||
image = malloc(sizeof(*image) +
|
||||
width * height * sizeof(uint32_t));
|
||||
if (!image)
|
||||
return NULL;
|
||||
|
@ -173,7 +173,7 @@ xcursor_images_create(int size)
|
|||
{
|
||||
struct xcursor_images *images;
|
||||
|
||||
images = malloc(sizeof(struct xcursor_images) +
|
||||
images = malloc(sizeof(*images) +
|
||||
size * sizeof(struct xcursor_image *));
|
||||
if (!images)
|
||||
return NULL;
|
||||
|
@ -228,7 +228,7 @@ xcursor_file_header_create(uint32_t ntoc)
|
|||
|
||||
if (ntoc > 0x10000)
|
||||
return NULL;
|
||||
file_header = malloc(sizeof(struct xcursor_file_header) +
|
||||
file_header = malloc(sizeof(*file_header) +
|
||||
ntoc * sizeof(struct xcursor_file_toc));
|
||||
if (!file_header)
|
||||
return NULL;
|
||||
|
|
|
@ -402,8 +402,7 @@ static void xwm_selection_get_targets(struct wlr_xwm_selection *selection) {
|
|||
struct wlr_xwm *xwm = selection->xwm;
|
||||
|
||||
if (selection == &xwm->clipboard_selection) {
|
||||
struct x11_data_source *source =
|
||||
calloc(1, sizeof(struct x11_data_source));
|
||||
struct x11_data_source *source = calloc(1, sizeof(*source));
|
||||
if (source == NULL) {
|
||||
return;
|
||||
}
|
||||
|
@ -421,8 +420,7 @@ static void xwm_selection_get_targets(struct wlr_xwm_selection *selection) {
|
|||
wlr_data_source_destroy(&source->base);
|
||||
}
|
||||
} else if (selection == &xwm->primary_selection) {
|
||||
struct x11_primary_selection_source *source =
|
||||
calloc(1, sizeof(struct x11_primary_selection_source));
|
||||
struct x11_primary_selection_source *source = calloc(1, sizeof(*source));
|
||||
if (source == NULL) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -269,8 +269,7 @@ static bool xwm_selection_send_data(struct wlr_xwm_selection *selection,
|
|||
return false;
|
||||
}
|
||||
|
||||
struct wlr_xwm_selection_transfer *transfer =
|
||||
calloc(1, sizeof(struct wlr_xwm_selection_transfer));
|
||||
struct wlr_xwm_selection_transfer *transfer = calloc(1, sizeof(*transfer));
|
||||
if (transfer == NULL) {
|
||||
wlr_log(WLR_ERROR, "Allocation failed");
|
||||
return false;
|
||||
|
|
|
@ -454,8 +454,7 @@ struct wlr_xwayland_server *wlr_xwayland_server_create(
|
|||
return NULL;
|
||||
}
|
||||
|
||||
struct wlr_xwayland_server *server =
|
||||
calloc(1, sizeof(struct wlr_xwayland_server));
|
||||
struct wlr_xwayland_server *server = calloc(1, sizeof(*server));
|
||||
if (!server) {
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
@ -82,7 +82,7 @@ void wlr_xwayland_destroy(struct wlr_xwayland *xwayland) {
|
|||
|
||||
struct wlr_xwayland *wlr_xwayland_create(struct wl_display *wl_display,
|
||||
struct wlr_compositor *compositor, bool lazy) {
|
||||
struct wlr_xwayland *xwayland = calloc(1, sizeof(struct wlr_xwayland));
|
||||
struct wlr_xwayland *xwayland = calloc(1, sizeof(*xwayland));
|
||||
if (!xwayland) {
|
||||
return NULL;
|
||||
}
|
||||
|
@ -139,7 +139,7 @@ void wlr_xwayland_set_cursor(struct wlr_xwayland *xwayland,
|
|||
|
||||
free(xwayland->cursor);
|
||||
|
||||
xwayland->cursor = calloc(1, sizeof(struct wlr_xwayland_cursor));
|
||||
xwayland->cursor = calloc(1, sizeof(*xwayland->cursor));
|
||||
if (xwayland->cursor == NULL) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -135,8 +135,7 @@ static int xwayland_surface_handle_ping_timeout(void *data) {
|
|||
static struct wlr_xwayland_surface *xwayland_surface_create(
|
||||
struct wlr_xwm *xwm, xcb_window_t window_id, int16_t x, int16_t y,
|
||||
uint16_t width, uint16_t height, bool override_redirect) {
|
||||
struct wlr_xwayland_surface *surface =
|
||||
calloc(1, sizeof(struct wlr_xwayland_surface));
|
||||
struct wlr_xwayland_surface *surface = calloc(1, sizeof(*surface));
|
||||
if (!surface) {
|
||||
wlr_log(WLR_ERROR, "Could not allocate wlr xwayland surface");
|
||||
return NULL;
|
||||
|
@ -681,7 +680,7 @@ static void read_surface_hints(struct wlr_xwm *xwm,
|
|||
}
|
||||
|
||||
free(xsurface->hints);
|
||||
xsurface->hints = calloc(1, sizeof(xcb_icccm_wm_hints_t));
|
||||
xsurface->hints = calloc(1, sizeof(*xsurface->hints));
|
||||
if (xsurface->hints == NULL) {
|
||||
return;
|
||||
}
|
||||
|
@ -704,7 +703,7 @@ static void read_surface_normal_hints(struct wlr_xwm *xwm,
|
|||
}
|
||||
|
||||
free(xsurface->size_hints);
|
||||
xsurface->size_hints = calloc(1, sizeof(xcb_size_hints_t));
|
||||
xsurface->size_hints = calloc(1, sizeof(*xsurface->size_hints));
|
||||
if (xsurface->size_hints == NULL) {
|
||||
return;
|
||||
}
|
||||
|
@ -777,7 +776,7 @@ static void read_surface_strut_partial(struct wlr_xwm *xwm,
|
|||
}
|
||||
|
||||
free(xsurface->strut_partial);
|
||||
xsurface->strut_partial = calloc(1, sizeof(xcb_ewmh_wm_strut_partial_t));
|
||||
xsurface->strut_partial = calloc(1, sizeof(*xsurface->strut_partial));
|
||||
if (xsurface->strut_partial == NULL) {
|
||||
return;
|
||||
}
|
||||
|
@ -1433,7 +1432,7 @@ static void xwm_handle_net_startup_info_message(struct wlr_xwm *xwm,
|
|||
start = curr->msg + curr->len;
|
||||
curr->len += buf_len;
|
||||
} else {
|
||||
curr = calloc(1, sizeof(struct pending_startup_id));
|
||||
curr = calloc(1, sizeof(*curr));
|
||||
if (!curr)
|
||||
return;
|
||||
curr->window = ev->window;
|
||||
|
@ -2111,7 +2110,7 @@ void xwm_set_cursor(struct wlr_xwm *xwm, const uint8_t *pixels, uint32_t stride,
|
|||
}
|
||||
|
||||
struct wlr_xwm *xwm_create(struct wlr_xwayland *xwayland, int wm_fd) {
|
||||
struct wlr_xwm *xwm = calloc(1, sizeof(struct wlr_xwm));
|
||||
struct wlr_xwm *xwm = calloc(1, sizeof(*xwm));
|
||||
if (xwm == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue