diff options
author | Lennart Poettering <lennart@poettering.net> | 2018-08-03 18:53:09 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2018-10-13 12:59:29 +0200 |
commit | 8c29a4570993105fecc12288596d2ee77c7f82b8 (patch) | |
tree | 9b3b515812f3949e6a95b6cdaaabcc3ac037da49 /src/login/logind-seat.h | |
parent | fd8879498d50b19c5abd0a90daa8f87be6ff6e9f (diff) | |
download | systemd-8c29a4570993105fecc12288596d2ee77c7f82b8.tar.gz |
logind: rework Seat/Session/User object allocation and freeing a bit
Let's update things a bit to follow current practices:
- User structure initialization rather than zero-initialized allocation
- Always propagate proper errors from allocation functions
- Use _cleanup_ for freeing objects when allocation fails half-way
- Make destructors return NULL
Diffstat (limited to 'src/login/logind-seat.h')
-rw-r--r-- | src/login/logind-seat.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/login/logind-seat.h b/src/login/logind-seat.h index 70878bbe52..51cd468e26 100644 --- a/src/login/logind-seat.h +++ b/src/login/logind-seat.h @@ -27,8 +27,10 @@ struct Seat { LIST_FIELDS(Seat, gc_queue); }; -Seat *seat_new(Manager *m, const char *id); -void seat_free(Seat *s); +int seat_new(Seat **ret, Manager *m, const char *id); +Seat* seat_free(Seat *s); + +DEFINE_TRIVIAL_CLEANUP_FUNC(Seat *, seat_free); int seat_save(Seat *s); int seat_load(Seat *s); |