mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2025-11-18 06:59:44 -05: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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue