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/mount | |
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 'src/mount')
-rw-r--r-- | src/mount/mount-tool.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/mount/mount-tool.c b/src/mount/mount-tool.c index e7878a6792..02989301fe 100644 --- a/src/mount/mount-tool.c +++ b/src/mount/mount-tool.c @@ -915,8 +915,8 @@ static int stop_mounts( } static int umount_by_device(sd_bus *bus, const char *what) { - _cleanup_udev_device_unref_ struct udev_device *d = NULL; - _cleanup_udev_unref_ struct udev *udev = NULL; + _cleanup_(udev_device_unrefp) struct udev_device *d = NULL; + _cleanup_(udev_unrefp) struct udev *udev = NULL; _cleanup_strv_free_ char **list = NULL; struct stat st; const char *v; @@ -1237,8 +1237,8 @@ static int acquire_removable(struct udev_device *d) { } static int discover_loop_backing_file(void) { - _cleanup_udev_device_unref_ struct udev_device *d = NULL; - _cleanup_udev_unref_ struct udev *udev = NULL; + _cleanup_(udev_device_unrefp) struct udev_device *d = NULL; + _cleanup_(udev_unrefp) struct udev *udev = NULL; _cleanup_free_ char *loop_dev = NULL; struct stat st; const char *v; @@ -1312,8 +1312,8 @@ static int discover_loop_backing_file(void) { } static int discover_device(void) { - _cleanup_udev_device_unref_ struct udev_device *d = NULL; - _cleanup_udev_unref_ struct udev *udev = NULL; + _cleanup_(udev_device_unrefp) struct udev_device *d = NULL; + _cleanup_(udev_unrefp) struct udev *udev = NULL; struct stat st; const char *v; int r; @@ -1406,8 +1406,8 @@ static int list_devices(void) { [COLUMN_UUID] = "UUID" }; - _cleanup_udev_enumerate_unref_ struct udev_enumerate *e = NULL; - _cleanup_udev_unref_ struct udev *udev = NULL; + _cleanup_(udev_enumerate_unrefp) struct udev_enumerate *e = NULL; + _cleanup_(udev_unrefp) struct udev *udev = NULL; struct udev_list_entry *item = NULL, *first = NULL; size_t n_allocated = 0, n = 0, i; size_t column_width[_COLUMN_MAX]; @@ -1440,7 +1440,7 @@ static int list_devices(void) { first = udev_enumerate_get_list_entry(e); udev_list_entry_foreach(item, first) { - _cleanup_udev_device_unref_ struct udev_device *d; + _cleanup_(udev_device_unrefp) struct udev_device *d; struct item *j; d = udev_device_new_from_syspath(udev, udev_list_entry_get_name(item)); |