diff options
author | Alexander Orzechowski <orzechowski.alexander@gmail.com> | 2022-10-13 12:10:23 -0400 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2022-10-13 16:36:05 +0000 |
commit | 5ba6cf517b6dd95e6d04b97ddd7dbc4b59ea4825 (patch) | |
tree | 65288e31ac266a5f966d711a008396268f3e0325 | |
parent | 0c0cea02587f5f31c88c4af75fcf082843b24b85 (diff) |
wlr_scene: use wl_container_of() instead of casts
-rw-r--r-- | types/scene/wlr_scene.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/types/scene/wlr_scene.c b/types/scene/wlr_scene.c index f786ca92..9c274f39 100644 --- a/types/scene/wlr_scene.c +++ b/types/scene/wlr_scene.c @@ -21,19 +21,22 @@ static struct wlr_scene_tree *scene_tree_from_node(struct wlr_scene_node *node) { assert(node->type == WLR_SCENE_NODE_TREE); - return (struct wlr_scene_tree *)node; + struct wlr_scene_tree *tree = wl_container_of(node, tree, node); + return tree; } static struct wlr_scene_rect *scene_rect_from_node( struct wlr_scene_node *node) { assert(node->type == WLR_SCENE_NODE_RECT); - return (struct wlr_scene_rect *)node; + struct wlr_scene_rect *rect = wl_container_of(node, rect, node); + return rect; } struct wlr_scene_buffer *wlr_scene_buffer_from_node( struct wlr_scene_node *node) { assert(node->type == WLR_SCENE_NODE_BUFFER); - return (struct wlr_scene_buffer *)node; + struct wlr_scene_buffer *buffer = wl_container_of(node, buffer, node); + return buffer; } struct wlr_scene *scene_node_get_root(struct wlr_scene_node *node) { |