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
|
|
@ -257,7 +257,8 @@ bool data_source_is_xwayland(
|
|||
static struct x11_data_source *data_source_from_wlr_data_source(
|
||||
struct wlr_data_source *wlr_source) {
|
||||
assert(data_source_is_xwayland(wlr_source));
|
||||
return (struct x11_data_source *)wlr_source;
|
||||
struct x11_data_source *source = wl_container_of(wlr_source, source, base);
|
||||
return source;
|
||||
}
|
||||
|
||||
static void data_source_send(struct wlr_data_source *wlr_source,
|
||||
|
|
@ -299,8 +300,7 @@ bool primary_selection_source_is_xwayland(
|
|||
static void primary_selection_source_send(
|
||||
struct wlr_primary_selection_source *wlr_source,
|
||||
const char *mime_type, int fd) {
|
||||
struct x11_primary_selection_source *source =
|
||||
(struct x11_primary_selection_source *)wlr_source;
|
||||
struct x11_primary_selection_source *source = wl_container_of(wlr_source, source, base);
|
||||
struct wlr_xwm_selection *selection = source->selection;
|
||||
|
||||
source_send(selection, &wlr_source->mime_types, &source->mime_types_atoms,
|
||||
|
|
@ -309,8 +309,7 @@ static void primary_selection_source_send(
|
|||
|
||||
static void primary_selection_source_destroy(
|
||||
struct wlr_primary_selection_source *wlr_source) {
|
||||
struct x11_primary_selection_source *source =
|
||||
(struct x11_primary_selection_source *)wlr_source;
|
||||
struct x11_primary_selection_source *source = wl_container_of(wlr_source, source, base);
|
||||
wl_array_release(&source->mime_types_atoms);
|
||||
free(source);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue