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/headless | |
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/headless')
-rw-r--r-- | backend/headless/backend.c | 3 | ||||
-rw-r--r-- | backend/headless/output.c | 3 |
2 files changed, 4 insertions, 2 deletions
diff --git a/backend/headless/backend.c b/backend/headless/backend.c index df14d6af..f0cde0c7 100644 --- a/backend/headless/backend.c +++ b/backend/headless/backend.c @@ -7,7 +7,8 @@ struct wlr_headless_backend *headless_backend_from_backend( struct wlr_backend *wlr_backend) { assert(wlr_backend_is_headless(wlr_backend)); - return (struct wlr_headless_backend *)wlr_backend; + struct wlr_headless_backend *backend = wl_container_of(wlr_backend, backend, backend); + return backend; } static bool backend_start(struct wlr_backend *wlr_backend) { diff --git a/backend/headless/output.c b/backend/headless/output.c index db7b707f..9cac54d1 100644 --- a/backend/headless/output.c +++ b/backend/headless/output.c @@ -17,7 +17,8 @@ static size_t last_output_num = 0; static struct wlr_headless_output *headless_output_from_output( struct wlr_output *wlr_output) { assert(wlr_output_is_headless(wlr_output)); - return (struct wlr_headless_output *)wlr_output; + struct wlr_headless_output *output = wl_container_of(wlr_output, output, wlr_output); + return output; } static bool output_set_custom_mode(struct wlr_headless_output *output, |