diff options
author | Lennart Poettering <lennart@poettering.net> | 2018-04-25 12:31:45 +0200 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2018-04-25 12:31:45 +0200 |
commit | 8e766630f006fcb17ad575bd4f3000e2d2dc890f (patch) | |
tree | 5b80e86c17142add180769d82db29e2627874304 /src/udev/udevd.c | |
parent | Merge pull request #8807 from ChrisLesiak/systemd-update-done-mtime-fix (diff) | |
download | systemd-8e766630f006fcb17ad575bd4f3000e2d2dc890f.tar.xz systemd-8e766630f006fcb17ad575bd4f3000e2d2dc890f.zip |
tree-wide: drop redundant _cleanup_ macros (#8810)
This drops a good number of type-specific _cleanup_ macros, and patches
all users to just use the generic ones.
In most recent code we abstained from defining type-specific macros, and
this basically removes all those added already, with the exception of
the really low-level ones.
Having explicit macros for this is not too useful, as the expression
without the extra macro is generally just 2ch wider. We should generally
emphesize generic code, unless there are really good reasons for
specific code, hence let's follow this in this case too.
Note that _cleanup_free_ and similar really low-level, libc'ish, Linux
API'ish macros continue to be defined, only the really high-level OO
ones are dropped. From now on this should really be the rule: for really
low-level stuff, such as memory allocation, fd handling and so one, go
ahead and define explicit per-type macros, but for high-level, specific
program code, just use the generic _cleanup_() macro directly, in order
to keep things simple and as readable as possible for the uninitiated.
Note that before this patch some of the APIs (notable libudev ones) were
already used with the high-level macros at some places and with the
generic _cleanup_ macro at others. With this patch we hence unify on the
latter.
Diffstat (limited to '')
-rw-r--r-- | src/udev/udevd.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/udev/udevd.c b/src/udev/udevd.c index c30e98dd98..0e75010db2 100644 --- a/src/udev/udevd.c +++ b/src/udev/udevd.c @@ -326,7 +326,7 @@ static int worker_send_message(int fd) { static void worker_spawn(Manager *manager, struct event *event) { struct udev *udev = event->udev; - _cleanup_udev_monitor_unref_ struct udev_monitor *worker_monitor = NULL; + _cleanup_(udev_monitor_unrefp) struct udev_monitor *worker_monitor = NULL; pid_t pid; int r = 0; @@ -921,8 +921,8 @@ static int on_uevent(sd_event_source *s, int fd, uint32_t revents, void *userdat /* receive the udevd message from userspace */ static int on_ctrl_msg(sd_event_source *s, int fd, uint32_t revents, void *userdata) { Manager *manager = userdata; - _cleanup_udev_ctrl_connection_unref_ struct udev_ctrl_connection *ctrl_conn = NULL; - _cleanup_udev_ctrl_msg_unref_ struct udev_ctrl_msg *ctrl_msg = NULL; + _cleanup_(udev_ctrl_connection_unrefp) struct udev_ctrl_connection *ctrl_conn = NULL; + _cleanup_(udev_ctrl_msg_unrefp) struct udev_ctrl_msg *ctrl_msg = NULL; const char *str; int i; @@ -1019,7 +1019,7 @@ static int synthesize_change(struct udev_device *dev) { bool has_partitions = false; int fd; struct udev *udev = udev_device_get_udev(dev); - _cleanup_udev_enumerate_unref_ struct udev_enumerate *e = NULL; + _cleanup_(udev_enumerate_unrefp) struct udev_enumerate *e = NULL; struct udev_list_entry *item; /* @@ -1057,7 +1057,7 @@ static int synthesize_change(struct udev_device *dev) { return r; udev_list_entry_foreach(item, udev_enumerate_get_list_entry(e)) { - _cleanup_udev_device_unref_ struct udev_device *d = NULL; + _cleanup_(udev_device_unrefp) struct udev_device *d = NULL; d = udev_device_new_from_syspath(udev, udev_list_entry_get_name(item)); if (!d) @@ -1087,7 +1087,7 @@ static int synthesize_change(struct udev_device *dev) { write_string_file(filename, "change", WRITE_STRING_FILE_CREATE); udev_list_entry_foreach(item, udev_enumerate_get_list_entry(e)) { - _cleanup_udev_device_unref_ struct udev_device *d = NULL; + _cleanup_(udev_device_unrefp) struct udev_device *d = NULL; d = udev_device_new_from_syspath(udev, udev_list_entry_get_name(item)); if (!d) @@ -1129,7 +1129,7 @@ static int on_inotify(sd_event_source *s, int fd, uint32_t revents, void *userda } FOREACH_INOTIFY_EVENT(e, buffer, l) { - _cleanup_udev_device_unref_ struct udev_device *dev = NULL; + _cleanup_(udev_device_unrefp) struct udev_device *dev = NULL; dev = udev_watch_lookup(manager->udev, e->wd); if (!dev) @@ -1256,7 +1256,7 @@ static int on_post(sd_event_source *s, void *userdata) { } static int listen_fds(int *rctrl, int *rnetlink) { - _cleanup_udev_unref_ struct udev *udev = NULL; + _cleanup_(udev_unrefp) struct udev *udev = NULL; int ctrl_fd = -1, netlink_fd = -1; int fd, n, r; @@ -1286,7 +1286,7 @@ static int listen_fds(int *rctrl, int *rnetlink) { } if (ctrl_fd < 0) { - _cleanup_udev_ctrl_unref_ struct udev_ctrl *ctrl = NULL; + _cleanup_(udev_ctrl_unrefp) struct udev_ctrl *ctrl = NULL; udev = udev_new(); if (!udev) @@ -1310,7 +1310,7 @@ static int listen_fds(int *rctrl, int *rnetlink) { } if (netlink_fd < 0) { - _cleanup_udev_monitor_unref_ struct udev_monitor *monitor = NULL; + _cleanup_(udev_monitor_unrefp) struct udev_monitor *monitor = NULL; if (!udev) { udev = udev_new(); |