diff options
author | Simon Ser <contact@emersion.fr> | 2023-07-11 17:54:08 +0200 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2023-07-11 20:16:17 +0200 |
commit | fe06e5f49a12174ceeb5e307bf5c3d7f623177d5 (patch) | |
tree | 40984fb21cd0cbf6be531206a86167298ab2d537 /backend/drm | |
parent | c2c536de034cc27d3a15001cc478f5a327b8f910 (diff) |
Use wl_container_of() instead of casts
This slightly improves type safety.
The culprits were found with:
git grep -E '\([a-z0-9_ ]+ \*\)\W?[a-z]'
Diffstat (limited to 'backend/drm')
-rw-r--r-- | backend/drm/backend.c | 3 | ||||
-rw-r--r-- | backend/drm/drm.c | 3 |
2 files changed, 4 insertions, 2 deletions
diff --git a/backend/drm/backend.c b/backend/drm/backend.c index b3af3005..54852185 100644 --- a/backend/drm/backend.c +++ b/backend/drm/backend.c @@ -16,7 +16,8 @@ struct wlr_drm_backend *get_drm_backend_from_backend( struct wlr_backend *wlr_backend) { assert(wlr_backend_is_drm(wlr_backend)); - return (struct wlr_drm_backend *)wlr_backend; + struct wlr_drm_backend *backend = wl_container_of(wlr_backend, backend, backend); + return backend; } static bool backend_start(struct wlr_backend *backend) { diff --git a/backend/drm/drm.c b/backend/drm/drm.c index 5f71f923..fdbab3bf 100644 --- a/backend/drm/drm.c +++ b/backend/drm/drm.c @@ -331,7 +331,8 @@ void finish_drm_resources(struct wlr_drm_backend *drm) { static struct wlr_drm_connector *get_drm_connector_from_output( struct wlr_output *wlr_output) { assert(wlr_output_is_drm(wlr_output)); - return (struct wlr_drm_connector *)wlr_output; + struct wlr_drm_connector *conn = wl_container_of(wlr_output, conn, output); + return conn; } static void layer_handle_addon_destroy(struct wlr_addon *addon) { |