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]'
This commit is contained in:
Simon Ser 2023-07-11 17:54:08 +02:00
parent c2c536de03
commit fe06e5f49a
29 changed files with 85 additions and 55 deletions

View file

@ -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) {