mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2025-10-29 05:40:12 -04:00
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:
parent
c2c536de03
commit
fe06e5f49a
29 changed files with 85 additions and 55 deletions
|
|
@ -46,9 +46,10 @@ struct wlr_wl_linux_dmabuf_v1_table_entry {
|
|||
uint64_t modifier;
|
||||
};
|
||||
|
||||
struct wlr_wl_backend *get_wl_backend_from_backend(struct wlr_backend *backend) {
|
||||
assert(wlr_backend_is_wl(backend));
|
||||
return (struct wlr_wl_backend *)backend;
|
||||
struct wlr_wl_backend *get_wl_backend_from_backend(struct wlr_backend *wlr_backend) {
|
||||
assert(wlr_backend_is_wl(wlr_backend));
|
||||
struct wlr_wl_backend *backend = wl_container_of(wlr_backend, backend, backend);
|
||||
return backend;
|
||||
}
|
||||
|
||||
static int dispatch_events(int fd, uint32_t mask, void *data) {
|
||||
|
|
|
|||
|
|
@ -39,7 +39,8 @@ static size_t last_output_num = 0;
|
|||
static struct wlr_wl_output *get_wl_output_from_output(
|
||||
struct wlr_output *wlr_output) {
|
||||
assert(wlr_output_is_wl(wlr_output));
|
||||
return (struct wlr_wl_output *)wlr_output;
|
||||
struct wlr_wl_output *output = wl_container_of(wlr_output, output, wlr_output);
|
||||
return output;
|
||||
}
|
||||
|
||||
static void surface_frame_callback(void *data, struct wl_callback *cb,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue