aboutsummaryrefslogtreecommitdiff
path: root/render/pixman
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2023-07-11 17:54:08 +0200
committerSimon Ser <contact@emersion.fr>2023-07-11 20:16:17 +0200
commitfe06e5f49a12174ceeb5e307bf5c3d7f623177d5 (patch)
tree40984fb21cd0cbf6be531206a86167298ab2d537 /render/pixman
parentc2c536de034cc27d3a15001cc478f5a327b8f910 (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 'render/pixman')
-rw-r--r--render/pixman/renderer.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/render/pixman/renderer.c b/render/pixman/renderer.c
index e7185e56..770f47ca 100644
--- a/render/pixman/renderer.c
+++ b/render/pixman/renderer.c
@@ -20,7 +20,8 @@ bool wlr_renderer_is_pixman(struct wlr_renderer *wlr_renderer) {
static struct wlr_pixman_renderer *get_renderer(
struct wlr_renderer *wlr_renderer) {
assert(wlr_renderer_is_pixman(wlr_renderer));
- return (struct wlr_pixman_renderer *)wlr_renderer;
+ struct wlr_pixman_renderer *renderer = wl_container_of(wlr_renderer, renderer, wlr_renderer);
+ return renderer;
}
bool begin_pixman_data_ptr_access(struct wlr_buffer *wlr_buffer, pixman_image_t **image_ptr,
@@ -76,7 +77,8 @@ bool wlr_texture_is_pixman(struct wlr_texture *texture) {
static struct wlr_pixman_texture *get_texture(
struct wlr_texture *wlr_texture) {
assert(wlr_texture_is_pixman(wlr_texture));
- return (struct wlr_pixman_texture *)wlr_texture;
+ struct wlr_pixman_texture *texture = wl_container_of(wlr_texture, texture, wlr_texture);
+ return texture;
}
static void texture_destroy(struct wlr_texture *wlr_texture) {