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

@ -25,7 +25,8 @@ bool wlr_texture_is_gles2(struct wlr_texture *wlr_texture) {
struct wlr_gles2_texture *gles2_get_texture(
struct wlr_texture *wlr_texture) {
assert(wlr_texture_is_gles2(wlr_texture));
return (struct wlr_gles2_texture *)wlr_texture;
struct wlr_gles2_texture *texture = wl_container_of(wlr_texture, texture, wlr_texture);
return texture;
}
static bool gles2_texture_update_from_buffer(struct wlr_texture *wlr_texture,