logind: place 'ret' param at last

This commit is contained in:
Mike Yuan
2024-03-02 23:50:26 +08:00
parent e440426221
commit 2454cee32e
7 changed files with 15 additions and 18 deletions
+3 -3
View File
@@ -118,7 +118,7 @@ int manager_add_seat(Manager *m, const char *id, Seat **ret_seat) {
s = hashmap_get(m->seats, id); s = hashmap_get(m->seats, id);
if (!s) { if (!s) {
r = seat_new(&s, m, id); r = seat_new(m, id, &s);
if (r < 0) if (r < 0)
return r; return r;
} }
@@ -138,7 +138,7 @@ int manager_add_session(Manager *m, const char *id, Session **ret_session) {
s = hashmap_get(m->sessions, id); s = hashmap_get(m->sessions, id);
if (!s) { if (!s) {
r = session_new(&s, m, id); r = session_new(m, id, &s);
if (r < 0) if (r < 0)
return r; return r;
} }
@@ -162,7 +162,7 @@ int manager_add_user(
u = hashmap_get(m->users, UID_TO_PTR(ur->uid)); u = hashmap_get(m->users, UID_TO_PTR(ur->uid));
if (!u) { if (!u) {
r = user_new(&u, m, ur); r = user_new(m, ur, &u);
if (r < 0) if (r < 0)
return r; return r;
} }
+2 -2
View File
@@ -25,13 +25,13 @@
#include "terminal-util.h" #include "terminal-util.h"
#include "tmpfile-util.h" #include "tmpfile-util.h"
int seat_new(Seat** ret, Manager *m, const char *id) { int seat_new(Manager *m, const char *id, Seat **ret) {
_cleanup_(seat_freep) Seat *s = NULL; _cleanup_(seat_freep) Seat *s = NULL;
int r; int r;
assert(ret);
assert(m); assert(m);
assert(id); assert(id);
assert(ret);
if (!seat_name_is_valid(id)) if (!seat_name_is_valid(id))
return -EINVAL; return -EINVAL;
+2 -2
View File
@@ -26,10 +26,10 @@ struct Seat {
LIST_FIELDS(Seat, gc_queue); LIST_FIELDS(Seat, gc_queue);
}; };
int seat_new(Seat **ret, Manager *m, const char *id); int seat_new(Manager *m, const char *id, Seat **ret);
Seat* seat_free(Seat *s); Seat* seat_free(Seat *s);
DEFINE_TRIVIAL_CLEANUP_FUNC(Seat *, seat_free); DEFINE_TRIVIAL_CLEANUP_FUNC(Seat*, seat_free);
int seat_save(Seat *s); int seat_save(Seat *s);
int seat_load(Seat *s); int seat_load(Seat *s);
+2 -2
View File
@@ -46,13 +46,13 @@
static void session_remove_fifo(Session *s); static void session_remove_fifo(Session *s);
static void session_restore_vt(Session *s); static void session_restore_vt(Session *s);
int session_new(Session **ret, Manager *m, const char *id) { int session_new(Manager *m, const char *id, Session **ret) {
_cleanup_(session_freep) Session *s = NULL; _cleanup_(session_freep) Session *s = NULL;
int r; int r;
assert(ret);
assert(m); assert(m);
assert(id); assert(id);
assert(ret);
if (!session_id_valid(id)) if (!session_id_valid(id))
return -EINVAL; return -EINVAL;
+2 -2
View File
@@ -164,10 +164,10 @@ struct Session {
LIST_FIELDS(Session, gc_queue); LIST_FIELDS(Session, gc_queue);
}; };
int session_new(Session **ret, Manager *m, const char *id); int session_new(Manager *m, const char *id, Session **ret);
Session* session_free(Session *s); Session* session_free(Session *s);
DEFINE_TRIVIAL_CLEANUP_FUNC(Session *, session_free); DEFINE_TRIVIAL_CLEANUP_FUNC(Session*, session_free);
void session_set_user(Session *s, User *u); void session_set_user(Session *s, User *u);
int session_set_leader_consume(Session *s, PidRef _leader); int session_set_leader_consume(Session *s, PidRef _leader);
+2 -5
View File
@@ -37,17 +37,14 @@
#include "unit-name.h" #include "unit-name.h"
#include "user-util.h" #include "user-util.h"
int user_new(User **ret, int user_new(Manager *m, UserRecord *ur, User **ret) {
Manager *m,
UserRecord *ur) {
_cleanup_(user_freep) User *u = NULL; _cleanup_(user_freep) User *u = NULL;
char lu[DECIMAL_STR_MAX(uid_t) + 1]; char lu[DECIMAL_STR_MAX(uid_t) + 1];
int r; int r;
assert(ret);
assert(m); assert(m);
assert(ur); assert(ur);
assert(ret);
if (!ur->user_name) if (!ur->user_name)
return -EINVAL; return -EINVAL;
+2 -2
View File
@@ -65,10 +65,10 @@ struct User {
LIST_FIELDS(User, gc_queue); LIST_FIELDS(User, gc_queue);
}; };
int user_new(User **out, Manager *m, UserRecord *ur); int user_new(Manager *m, UserRecord *ur, User **ret);
User *user_free(User *u); User *user_free(User *u);
DEFINE_TRIVIAL_CLEANUP_FUNC(User *, user_free); DEFINE_TRIVIAL_CLEANUP_FUNC(User*, user_free);
int user_start_service_manager(User *u); int user_start_service_manager(User *u);
int user_start(User *u); int user_start(User *u);