summaryrefslogtreecommitdiff
path: root/src/login
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2018-04-25 12:31:45 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2018-04-25 12:31:45 +0200
commit8e766630f006fcb17ad575bd4f3000e2d2dc890f (patch)
tree5b80e86c17142add180769d82db29e2627874304 /src/login
parent0d6f0ea6c1994a5769704d2150ce907a1132a8c8 (diff)
downloadsystemd-8e766630f006fcb17ad575bd4f3000e2d2dc890f.tar.gz
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/login')
-rw-r--r--src/login/logind-acl.c4
-rw-r--r--src/login/logind-core.c4
-rw-r--r--src/login/logind-dbus.c4
-rw-r--r--src/login/logind.c16
-rw-r--r--src/login/sysfs-show.c8
5 files changed, 18 insertions, 18 deletions
diff --git a/src/login/logind-acl.c b/src/login/logind-acl.c
index 178ba5cef6..af3b4a4d2d 100644
--- a/src/login/logind-acl.c
+++ b/src/login/logind-acl.c
@@ -168,7 +168,7 @@ int devnode_acl_all(struct udev *udev,
bool del, uid_t old_uid,
bool add, uid_t new_uid) {
- _cleanup_udev_enumerate_unref_ struct udev_enumerate *e = NULL;
+ _cleanup_(udev_enumerate_unrefp) struct udev_enumerate *e = NULL;
struct udev_list_entry *item = NULL, *first = NULL;
_cleanup_set_free_free_ Set *nodes = NULL;
_cleanup_closedir_ DIR *dir = NULL;
@@ -209,7 +209,7 @@ int devnode_acl_all(struct udev *udev,
first = udev_enumerate_get_list_entry(e);
udev_list_entry_foreach(item, first) {
- _cleanup_udev_device_unref_ struct udev_device *d = NULL;
+ _cleanup_(udev_device_unrefp) struct udev_device *d = NULL;
const char *node, *sn;
d = udev_device_new_from_syspath(udev, udev_list_entry_get_name(item));
diff --git a/src/login/logind-core.c b/src/login/logind-core.c
index 7f429aae41..ff36bb1c4c 100644
--- a/src/login/logind-core.c
+++ b/src/login/logind-core.c
@@ -499,7 +499,7 @@ static bool manager_is_docked(Manager *m) {
}
static int manager_count_external_displays(Manager *m) {
- _cleanup_udev_enumerate_unref_ struct udev_enumerate *e = NULL;
+ _cleanup_(udev_enumerate_unrefp) struct udev_enumerate *e = NULL;
struct udev_list_entry *item = NULL, *first = NULL;
int r;
int n = 0;
@@ -518,7 +518,7 @@ static int manager_count_external_displays(Manager *m) {
first = udev_enumerate_get_list_entry(e);
udev_list_entry_foreach(item, first) {
- _cleanup_udev_device_unref_ struct udev_device *d = NULL;
+ _cleanup_(udev_device_unrefp) struct udev_device *d = NULL;
struct udev_device *p;
const char *status, *enabled, *dash, *nn, *i;
bool external = false;
diff --git a/src/login/logind-dbus.c b/src/login/logind-dbus.c
index d92437b67f..bfa3f2d7d4 100644
--- a/src/login/logind-dbus.c
+++ b/src/login/logind-dbus.c
@@ -1246,7 +1246,7 @@ static int method_set_user_linger(sd_bus_message *message, void *userdata, sd_bu
}
static int trigger_device(Manager *m, struct udev_device *d) {
- _cleanup_udev_enumerate_unref_ struct udev_enumerate *e = NULL;
+ _cleanup_(udev_enumerate_unrefp) struct udev_enumerate *e = NULL;
struct udev_list_entry *first, *item;
int r;
@@ -1284,7 +1284,7 @@ static int trigger_device(Manager *m, struct udev_device *d) {
}
static int attach_device(Manager *m, const char *seat, const char *sysfs) {
- _cleanup_udev_device_unref_ struct udev_device *d = NULL;
+ _cleanup_(udev_device_unrefp) struct udev_device *d = NULL;
_cleanup_free_ char *rule = NULL, *file = NULL;
const char *id_for_seat;
int r;
diff --git a/src/login/logind.c b/src/login/logind.c
index 6bddcb541f..11ba08a126 100644
--- a/src/login/logind.c
+++ b/src/login/logind.c
@@ -193,7 +193,7 @@ static void manager_free(Manager *m) {
static int manager_enumerate_devices(Manager *m) {
struct udev_list_entry *item = NULL, *first = NULL;
- _cleanup_udev_enumerate_unref_ struct udev_enumerate *e = NULL;
+ _cleanup_(udev_enumerate_unrefp) struct udev_enumerate *e = NULL;
int r;
assert(m);
@@ -219,7 +219,7 @@ static int manager_enumerate_devices(Manager *m) {
first = udev_enumerate_get_list_entry(e);
udev_list_entry_foreach(item, first) {
- _cleanup_udev_device_unref_ struct udev_device *d = NULL;
+ _cleanup_(udev_device_unrefp) struct udev_device *d = NULL;
int k;
d = udev_device_new_from_syspath(m->udev, udev_list_entry_get_name(item));
@@ -235,7 +235,7 @@ static int manager_enumerate_devices(Manager *m) {
}
static int manager_enumerate_buttons(Manager *m) {
- _cleanup_udev_enumerate_unref_ struct udev_enumerate *e = NULL;
+ _cleanup_(udev_enumerate_unrefp) struct udev_enumerate *e = NULL;
struct udev_list_entry *item = NULL, *first = NULL;
int r;
@@ -268,7 +268,7 @@ static int manager_enumerate_buttons(Manager *m) {
first = udev_enumerate_get_list_entry(e);
udev_list_entry_foreach(item, first) {
- _cleanup_udev_device_unref_ struct udev_device *d = NULL;
+ _cleanup_(udev_device_unrefp) struct udev_device *d = NULL;
int k;
d = udev_device_new_from_syspath(m->udev, udev_list_entry_get_name(item));
@@ -591,7 +591,7 @@ static int manager_enumerate_inhibitors(Manager *m) {
}
static int manager_dispatch_seat_udev(sd_event_source *s, int fd, uint32_t revents, void *userdata) {
- _cleanup_udev_device_unref_ struct udev_device *d = NULL;
+ _cleanup_(udev_device_unrefp) struct udev_device *d = NULL;
Manager *m = userdata;
assert(m);
@@ -605,7 +605,7 @@ static int manager_dispatch_seat_udev(sd_event_source *s, int fd, uint32_t reven
}
static int manager_dispatch_device_udev(sd_event_source *s, int fd, uint32_t revents, void *userdata) {
- _cleanup_udev_device_unref_ struct udev_device *d = NULL;
+ _cleanup_(udev_device_unrefp) struct udev_device *d = NULL;
Manager *m = userdata;
assert(m);
@@ -619,7 +619,7 @@ static int manager_dispatch_device_udev(sd_event_source *s, int fd, uint32_t rev
}
static int manager_dispatch_vcsa_udev(sd_event_source *s, int fd, uint32_t revents, void *userdata) {
- _cleanup_udev_device_unref_ struct udev_device *d = NULL;
+ _cleanup_(udev_device_unrefp) struct udev_device *d = NULL;
Manager *m = userdata;
const char *name;
@@ -641,7 +641,7 @@ static int manager_dispatch_vcsa_udev(sd_event_source *s, int fd, uint32_t reven
}
static int manager_dispatch_button_udev(sd_event_source *s, int fd, uint32_t revents, void *userdata) {
- _cleanup_udev_device_unref_ struct udev_device *d = NULL;
+ _cleanup_(udev_device_unrefp) struct udev_device *d = NULL;
Manager *m = userdata;
assert(m);
diff --git a/src/login/sysfs-show.c b/src/login/sysfs-show.c
index ecef251d45..65993c49dd 100644
--- a/src/login/sysfs-show.c
+++ b/src/login/sysfs-show.c
@@ -43,7 +43,7 @@ static int show_sysfs_one(
max_width = n_columns;
while (*item) {
- _cleanup_udev_device_unref_ struct udev_device *d = NULL;
+ _cleanup_(udev_device_unrefp) struct udev_device *d = NULL;
struct udev_list_entry *next, *lookahead;
const char *sn, *name, *sysfs, *subsystem, *sysname;
_cleanup_free_ char *k = NULL, *l = NULL;
@@ -86,7 +86,7 @@ static int show_sysfs_one(
if (path_startswith(lookahead_sysfs, sub) &&
!path_startswith(lookahead_sysfs, sysfs)) {
- _cleanup_udev_device_unref_ struct udev_device *lookahead_d = NULL;
+ _cleanup_(udev_device_unrefp) struct udev_device *lookahead_d = NULL;
lookahead_d = udev_device_new_from_syspath(udev, lookahead_sysfs);
if (lookahead_d) {
@@ -142,8 +142,8 @@ static int show_sysfs_one(
}
int show_sysfs(const char *seat, const char *prefix, unsigned n_columns, OutputFlags flags) {
- _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 *first = NULL;
int r;