diff options
author | David Tardon <dtardon@redhat.com> | 2022-08-09 14:35:15 +0200 |
---|---|---|
committer | David Tardon <dtardon@redhat.com> | 2022-09-13 08:13:27 +0200 |
commit | 995340074e554b4bf4a0fdb0cb7436692c5a4ffd (patch) | |
tree | ca3ee001db3e608ee80478f42fea9c3b409f1b7b /src/home/homed-home-bus.c | |
parent | 6d64cb0625691e2b9eda8babe07ac8281f9467ee (diff) | |
download | systemd-995340074e554b4bf4a0fdb0cb7436692c5a4ffd.tar.gz |
tree-wide: use ASSERT_PTR more
Diffstat (limited to 'src/home/homed-home-bus.c')
-rw-r--r-- | src/home/homed-home-bus.c | 58 |
1 files changed, 19 insertions, 39 deletions
diff --git a/src/home/homed-home-bus.c b/src/home/homed-home-bus.c index 4663792e5c..4e3fd5f0ae 100644 --- a/src/home/homed-home-bus.c +++ b/src/home/homed-home-bus.c @@ -21,11 +21,10 @@ static int property_get_unix_record( void *userdata, sd_bus_error *error) { - Home *h = userdata; + Home *h = ASSERT_PTR(userdata); assert(bus); assert(reply); - assert(h); return sd_bus_message_append( reply, "(suusss)", @@ -46,11 +45,10 @@ static int property_get_state( void *userdata, sd_bus_error *error) { - Home *h = userdata; + Home *h = ASSERT_PTR(userdata); assert(bus); assert(reply); - assert(h); return sd_bus_message_append(reply, "s", home_state_to_string(home_get_state(h))); } @@ -125,13 +123,12 @@ static int property_get_user_record( sd_bus_error *error) { _cleanup_free_ char *json = NULL; - Home *h = userdata; + Home *h = ASSERT_PTR(userdata); bool incomplete; int r; assert(bus); assert(reply); - assert(h); r = bus_home_get_record_json(h, sd_bus_get_current_message(bus), &json, &incomplete); if (r < 0) @@ -146,11 +143,10 @@ int bus_home_method_activate( sd_bus_error *error) { _cleanup_(user_record_unrefp) UserRecord *secret = NULL; - Home *h = userdata; + Home *h = ASSERT_PTR(userdata); int r; assert(message); - assert(h); r = bus_message_read_secret(message, &secret, error); if (r < 0) @@ -176,11 +172,10 @@ int bus_home_method_deactivate( void *userdata, sd_bus_error *error) { - Home *h = userdata; + Home *h = ASSERT_PTR(userdata); int r; assert(message); - assert(h); r = home_deactivate(h, false, error); if (r < 0) @@ -201,11 +196,10 @@ int bus_home_method_unregister( void *userdata, sd_bus_error *error) { - Home *h = userdata; + Home *h = ASSERT_PTR(userdata); int r; assert(message); - assert(h); r = bus_verify_polkit_async( message, @@ -238,11 +232,10 @@ int bus_home_method_realize( sd_bus_error *error) { _cleanup_(user_record_unrefp) UserRecord *secret = NULL; - Home *h = userdata; + Home *h = ASSERT_PTR(userdata); int r; assert(message); - assert(h); r = bus_message_read_secret(message, &secret, error); if (r < 0) @@ -283,11 +276,10 @@ int bus_home_method_remove( void *userdata, sd_bus_error *error) { - Home *h = userdata; + Home *h = ASSERT_PTR(userdata); int r; assert(message); - assert(h); r = bus_verify_polkit_async( message, @@ -324,11 +316,10 @@ int bus_home_method_fixate( sd_bus_error *error) { _cleanup_(user_record_unrefp) UserRecord *secret = NULL; - Home *h = userdata; + Home *h = ASSERT_PTR(userdata); int r; assert(message); - assert(h); r = bus_message_read_secret(message, &secret, error); if (r < 0) @@ -354,11 +345,10 @@ int bus_home_method_authenticate( sd_bus_error *error) { _cleanup_(user_record_unrefp) UserRecord *secret = NULL; - Home *h = userdata; + Home *h = ASSERT_PTR(userdata); int r; assert(message); - assert(h); r = bus_message_read_secret(message, &secret, error); if (r < 0) @@ -437,11 +427,10 @@ int bus_home_method_update( sd_bus_error *error) { _cleanup_(user_record_unrefp) UserRecord *hr = NULL; - Home *h = userdata; + Home *h = ASSERT_PTR(userdata); int r; assert(message); - assert(h); r = bus_message_read_home_record(message, USER_RECORD_REQUIRE_REGULAR|USER_RECORD_REQUIRE_SECRET|USER_RECORD_ALLOW_PRIVILEGED|USER_RECORD_ALLOW_PER_MACHINE|USER_RECORD_ALLOW_SIGNATURE|USER_RECORD_PERMISSIVE, &hr, error); if (r < 0) @@ -456,12 +445,11 @@ int bus_home_method_resize( sd_bus_error *error) { _cleanup_(user_record_unrefp) UserRecord *secret = NULL; - Home *h = userdata; + Home *h = ASSERT_PTR(userdata); uint64_t sz; int r; assert(message); - assert(h); r = sd_bus_message_read(message, "t", &sz); if (r < 0) @@ -505,11 +493,10 @@ int bus_home_method_change_password( sd_bus_error *error) { _cleanup_(user_record_unrefp) UserRecord *new_secret = NULL, *old_secret = NULL; - Home *h = userdata; + Home *h = ASSERT_PTR(userdata); int r; assert(message); - assert(h); r = bus_message_read_secret(message, &new_secret, error); if (r < 0) @@ -552,11 +539,10 @@ int bus_home_method_lock( void *userdata, sd_bus_error *error) { - Home *h = userdata; + Home *h = ASSERT_PTR(userdata); int r; assert(message); - assert(h); r = home_lock(h, error); if (r < 0) @@ -580,11 +566,10 @@ int bus_home_method_unlock( sd_bus_error *error) { _cleanup_(user_record_unrefp) UserRecord *secret = NULL; - Home *h = userdata; + Home *h = ASSERT_PTR(userdata); int r; assert(message); - assert(h); r = bus_message_read_secret(message, &secret, error); if (r < 0) @@ -614,10 +599,9 @@ int bus_home_method_acquire( _cleanup_(operation_unrefp) Operation *o = NULL; _cleanup_close_ int fd = -1; int r, please_suspend; - Home *h = userdata; + Home *h = ASSERT_PTR(userdata); assert(message); - assert(h); r = bus_message_read_secret(message, &secret, error); if (r < 0) @@ -652,12 +636,11 @@ int bus_home_method_ref( sd_bus_error *error) { _cleanup_close_ int fd = -1; - Home *h = userdata; + Home *h = ASSERT_PTR(userdata); HomeState state; int please_suspend, r; assert(message); - assert(h); r = sd_bus_message_read(message, "b", &please_suspend); if (r < 0) @@ -693,11 +676,10 @@ int bus_home_method_release( sd_bus_error *error) { _cleanup_(operation_unrefp) Operation *o = NULL; - Home *h = userdata; + Home *h = ASSERT_PTR(userdata); int r; assert(message); - assert(h); o = operation_new(OPERATION_RELEASE, message); if (!o) @@ -867,11 +849,9 @@ const BusObjectImplementation home_object = { static int on_deferred_change(sd_event_source *s, void *userdata) { _cleanup_free_ char *path = NULL; - Home *h = userdata; + Home *h = ASSERT_PTR(userdata); int r; - assert(h); - h->deferred_change_event_source = sd_event_source_disable_unref(h->deferred_change_event_source); r = bus_home_path(h, &path); |