diff options
author | Drew DeVault <sir@cmpwn.com> | 2018-09-18 14:44:46 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-09-18 14:44:46 -0400 |
commit | 3693fae0c44d83cab2c701bd44b80d8f6242781e (patch) | |
tree | 407d120898ff0a4c64de9a2d180ad07bd0d67e36 /backend/session/logind.c | |
parent | 9288c827aaf4ae8acac7a105f223dc612822b76d (diff) | |
parent | 139a905924e9c6cd22613dfbbe73c4642c993e41 (diff) |
Merge pull request #1248 from emersion/assert-all-the-things
Assert all the things!
Diffstat (limited to 'backend/session/logind.c')
-rw-r--r-- | backend/session/logind.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/backend/session/logind.c b/backend/session/logind.c index 2f816b95..39143a2f 100644 --- a/backend/session/logind.c +++ b/backend/session/logind.c @@ -37,8 +37,14 @@ struct logind_session { char *path; }; +static struct logind_session *logind_session_from_session( + struct wlr_session *base) { + assert(base->impl == &session_logind); + return (struct logind_session *)base; +} + static int logind_take_device(struct wlr_session *base, const char *path) { - struct logind_session *session = wl_container_of(base, session, base); + struct logind_session *session = logind_session_from_session(base); int ret; int fd = -1; @@ -83,7 +89,7 @@ error: } static void logind_release_device(struct wlr_session *base, int fd) { - struct logind_session *session = wl_container_of(base, session, base); + struct logind_session *session = logind_session_from_session(base); int ret; sd_bus_message *msg = NULL; @@ -108,7 +114,7 @@ static void logind_release_device(struct wlr_session *base, int fd) { } static bool logind_change_vt(struct wlr_session *base, unsigned vt) { - struct logind_session *session = wl_container_of(base, session, base); + struct logind_session *session = logind_session_from_session(base); // Only seat0 has VTs associated with it if (strcmp(session->base.seat, "seat0") != 0) { @@ -212,7 +218,7 @@ static void release_control(struct logind_session *session) { } static void logind_session_destroy(struct wlr_session *base) { - struct logind_session *session = wl_container_of(base, session, base); + struct logind_session *session = logind_session_from_session(base); release_control(session); |