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-manager.c | |
parent | Merge pull request #23087 from yuwata/udev-watch (diff) | |
download | systemd-995340074e554b4bf4a0fdb0cb7436692c5a4ffd.tar.xz systemd-995340074e554b4bf4a0fdb0cb7436692c5a4ffd.zip |
tree-wide: use ASSERT_PTR more
Diffstat (limited to 'src/home/homed-manager.c')
-rw-r--r-- | src/home/homed-manager.c | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/src/home/homed-manager.c b/src/home/homed-manager.c index d114236cf7..38945d7988 100644 --- a/src/home/homed-manager.c +++ b/src/home/homed-manager.c @@ -121,10 +121,9 @@ static void manager_watch_home(Manager *m) { static int on_home_inotify(sd_event_source *s, const struct inotify_event *event, void *userdata) { _cleanup_free_ char *j = NULL; - Manager *m = userdata; + Manager *m = ASSERT_PTR(userdata); const char *e, *n; - assert(m); assert(event); if ((event->mask & (IN_Q_OVERFLOW|IN_MOVE_SELF|IN_DELETE_SELF|IN_IGNORED|IN_UNMOUNT)) != 0) { @@ -1122,12 +1121,11 @@ static int on_notify_socket(sd_event_source *s, int fd, uint32_t revents, void * _cleanup_free_ void *datagram = NULL; _cleanup_close_ int passed_fd = -1; struct ucred sender = UCRED_INVALID; - Manager *m = userdata; + Manager *m = ASSERT_PTR(userdata); ssize_t n; Home *h; assert(s); - assert(m); n = read_datagram(fd, &sender, &datagram, &passed_fd); if (n < 0) { @@ -1271,10 +1269,9 @@ static int manager_add_device(Manager *m, sd_device *d) { } static int manager_on_device(sd_device_monitor *monitor, sd_device *d, void *userdata) { - Manager *m = userdata; + Manager *m = ASSERT_PTR(userdata); int r; - assert(m); assert(d); if (device_for_action(d, SD_DEVICE_REMOVE)) { @@ -1698,9 +1695,7 @@ int manager_gc_images(Manager *m) { } static int on_deferred_rescan(sd_event_source *s, void *userdata) { - Manager *m = userdata; - - assert(m); + Manager *m = ASSERT_PTR(userdata); m->deferred_rescan_event_source = sd_event_source_disable_unref(m->deferred_rescan_event_source); @@ -1736,9 +1731,7 @@ int manager_enqueue_rescan(Manager *m) { } static int on_deferred_gc(sd_event_source *s, void *userdata) { - Manager *m = userdata; - - assert(m); + Manager *m = ASSERT_PTR(userdata); m->deferred_gc_event_source = sd_event_source_disable_unref(m->deferred_gc_event_source); @@ -2095,10 +2088,9 @@ finish: } static int on_rebalance_timer(sd_event_source *s, usec_t t, void *userdata) { - Manager *m = userdata; + Manager *m = ASSERT_PTR(userdata); assert(s); - assert(m); assert(IN_SET(m->rebalance_state, REBALANCE_WAITING, REBALANCE_PENDING, REBALANCE_SHRINKING, REBALANCE_GROWING)); (void) manager_rebalance_now(m); |