]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
tree-wide: drop redundant _cleanup_ macros (#8810)
authorLennart Poettering <lennart@poettering.net>
Wed, 25 Apr 2018 10:31:45 +0000 (12:31 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 25 Apr 2018 10:31:45 +0000 (12:31 +0200)
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.

74 files changed:
src/analyze/analyze.c
src/backlight/backlight.c
src/basic/blkid-util.h
src/basic/lockfile-util.h
src/core/device.c
src/core/swap.c
src/core/umount.c
src/gpt-auto-generator/gpt-auto-generator.c
src/journal-remote/journal-remote-write.h
src/journal-remote/journal-remote.c
src/journal/journalctl.c
src/libsystemd-network/dhcp-identifier.c
src/libsystemd-network/sd-dhcp-server.c
src/login/logind-acl.c
src/login/logind-core.c
src/login/logind-dbus.c
src/login/logind.c
src/login/sysfs-show.c
src/mount/mount-tool.c
src/network/netdev/bridge.c
src/network/netdev/geneve.c
src/network/netdev/netdev.c
src/network/netdev/netdev.h
src/network/networkd-address-label.c
src/network/networkd-address-label.h
src/network/networkd-address.c
src/network/networkd-address.h
src/network/networkd-dhcp4.c
src/network/networkd-dhcp6.c
src/network/networkd-fdb.c
src/network/networkd-fdb.h
src/network/networkd-ipv4ll.c
src/network/networkd-link.c
src/network/networkd-link.h
src/network/networkd-manager.c
src/network/networkd-manager.h
src/network/networkd-ndisc.c
src/network/networkd-network.c
src/network/networkd-network.h
src/network/networkd-radv.c
src/network/networkd-radv.h
src/network/networkd-route.c
src/network/networkd-route.h
src/network/networkd-routing-policy-rule.c
src/network/networkd-routing-policy-rule.h
src/network/networkd.c
src/network/test-network.c
src/nspawn/nspawn-network.c
src/nspawn/nspawn.c
src/rfkill/rfkill.c
src/shared/bootspec.c
src/shared/dissect-image.c
src/shared/install.c
src/shared/machine-image.c
src/shared/machine-pool.c
src/shared/path-lookup.h
src/shared/udev-util.h
src/systemctl/systemctl.c
src/sysv-generator/sysv-generator.c
src/test/test-libudev.c
src/test/test-path-lookup.c
src/test/test-udev.c
src/udev/ata_id/ata_id.c
src/udev/scsi_id/scsi_id.c
src/udev/udev-builtin-blkid.c
src/udev/udev-builtin-hwdb.c
src/udev/udev-builtin-net_id.c
src/udev/udev-builtin-path_id.c
src/udev/udevadm-control.c
src/udev/udevadm-info.c
src/udev/udevadm-monitor.c
src/udev/udevadm-test.c
src/udev/udevadm-trigger.c
src/udev/udevd.c

index 179bb0f7999a9165dc49c16dba77f268c95e62e6..06add1171de23937554c587fe1c1ae9b2c0d35f6 100644 (file)
@@ -1425,7 +1425,7 @@ static int get_or_set_log_target(int argc, char *argv[], void *userdata) {
 }
 
 static int dump_unit_paths(int argc, char *argv[], void *userdata) {
-        _cleanup_lookup_paths_free_ LookupPaths paths = {};
+        _cleanup_(lookup_paths_free) LookupPaths paths = {};
         int r;
         char **p;
 
index b4d59ed59cf7c720f69c248cb7ec37923cd6c835..bb41462735ea22125ff10655cbc30ab3b1aa1ca5 100644 (file)
@@ -90,7 +90,7 @@ static bool same_device(struct udev_device *a, struct udev_device *b) {
 }
 
 static bool validate_device(struct udev *udev, struct udev_device *device) {
-        _cleanup_udev_enumerate_unref_ struct udev_enumerate *enumerate = NULL;
+        _cleanup_(udev_enumerate_unrefp) struct udev_enumerate *enumerate = NULL;
         struct udev_list_entry *item = NULL, *first = NULL;
         struct udev_device *parent;
         const char *v, *subsystem;
@@ -143,7 +143,7 @@ static bool validate_device(struct udev *udev, struct udev_device *device) {
 
         first = udev_enumerate_get_list_entry(enumerate);
         udev_list_entry_foreach(item, first) {
-                _cleanup_udev_device_unref_ struct udev_device *other;
+                _cleanup_(udev_device_unrefp) struct udev_device *other;
                 struct udev_device *other_parent;
                 const char *other_subsystem;
 
@@ -276,8 +276,8 @@ static bool shall_clamp(struct udev_device *d) {
 }
 
 int main(int argc, char *argv[]) {
-        _cleanup_udev_unref_ struct udev *udev = NULL;
-        _cleanup_udev_device_unref_ struct udev_device *device = NULL;
+        _cleanup_(udev_unrefp) struct udev *udev = NULL;
+        _cleanup_(udev_device_unrefp) struct udev_device *device = NULL;
         _cleanup_free_ char *escaped_ss = NULL, *escaped_sysname = NULL, *escaped_path_id = NULL;
         const char *sysname, *path_id, *ss, *saved;
         unsigned max_brightness;
index 4c9ef5b6012c1e391dd54c9ce656ad68ff9c0ccb..41a2c20fca124eb5abf1848c7da239f19348def2 100644 (file)
@@ -15,5 +15,4 @@
 
 #if HAVE_BLKID
 DEFINE_TRIVIAL_CLEANUP_FUNC(blkid_probe, blkid_free_probe);
-#define _cleanup_blkid_free_probe_ _cleanup_(blkid_free_probep)
 #endif
index c2dacbef986bb5309ad0b61fb4f4fb7b515c2ec8..457a39930a8bc8cd65bf38778ac8f6a2ff19b68b 100644 (file)
@@ -22,6 +22,4 @@ int make_lock_file(const char *p, int operation, LockFile *ret);
 int make_lock_file_for(const char *p, int operation, LockFile *ret);
 void release_lock_file(LockFile *f);
 
-#define _cleanup_release_lock_file_ _cleanup_(release_lock_file)
-
 #define LOCK_FILE_INIT { .fd = -1, .path = NULL }
index 296f763f87f3367bbc959346c17d415fe10045a3..1441d08b97a23bdc8819ab8488e5176d3e90b59e 100644 (file)
@@ -681,7 +681,7 @@ static void device_shutdown(Manager *m) {
 }
 
 static void device_enumerate(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;
 
@@ -746,7 +746,7 @@ static void device_enumerate(Manager *m) {
 
         first = udev_enumerate_get_list_entry(e);
         udev_list_entry_foreach(item, first) {
-                _cleanup_udev_device_unref_ struct udev_device *dev = NULL;
+                _cleanup_(udev_device_unrefp) struct udev_device *dev = NULL;
                 const char *sysfs;
 
                 sysfs = udev_list_entry_get_name(item);
@@ -772,7 +772,7 @@ fail:
 }
 
 static int device_dispatch_io(sd_event_source *source, int fd, uint32_t revents, void *userdata) {
-        _cleanup_udev_device_unref_ struct udev_device *dev = NULL;
+        _cleanup_(udev_device_unrefp) struct udev_device *dev = NULL;
         Manager *m = userdata;
         const char *action, *sysfs;
         int r;
@@ -873,7 +873,7 @@ static bool device_supported(void) {
 }
 
 int device_found_node(Manager *m, const char *node, bool add, DeviceFound found, bool now) {
-        _cleanup_udev_device_unref_ struct udev_device *dev = NULL;
+        _cleanup_(udev_device_unrefp) struct udev_device *dev = NULL;
         struct stat st;
 
         assert(m);
index 2c819a98e6b42872c4552484ef5b92071c3df457..4d9f4df6edac55d12bbd81e1db59375699217bd4 100644 (file)
@@ -251,7 +251,7 @@ static int swap_verify(Swap *s) {
 }
 
 static int swap_load_devnode(Swap *s) {
-        _cleanup_udev_device_unref_ struct udev_device *d = NULL;
+        _cleanup_(udev_device_unrefp) struct udev_device *d = NULL;
         struct stat st;
         const char *p;
 
@@ -425,7 +425,7 @@ fail:
 }
 
 static int swap_process_new(Manager *m, const char *device, int prio, bool set_flags) {
-        _cleanup_udev_device_unref_ struct udev_device *d = NULL;
+        _cleanup_(udev_device_unrefp) struct udev_device *d = NULL;
         struct udev_list_entry *item = NULL, *first = NULL;
         const char *dn;
         struct stat st;
index 017162f2fb3e12ea321b0646566bd62a1035d08c..c3decf307578c998ef85d72904c1aafa7c8a9dd2 100644 (file)
@@ -214,9 +214,9 @@ int swap_list_get(const char *swaps, MountPoint **head) {
 }
 
 static int loopback_list_get(MountPoint **head) {
-        _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_udev_unref_ struct udev *udev = NULL;
+        _cleanup_(udev_unrefp) struct udev *udev = NULL;
         int r;
 
         assert(head);
@@ -247,7 +247,7 @@ static int loopback_list_get(MountPoint **head) {
 
         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;
                 const char *dn;
                 _cleanup_free_ MountPoint *lb = NULL;
 
@@ -275,9 +275,9 @@ static int loopback_list_get(MountPoint **head) {
 }
 
 static int dm_list_get(MountPoint **head) {
-        _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_udev_unref_ struct udev *udev = NULL;
+        _cleanup_(udev_unrefp) struct udev *udev = NULL;
         int r;
 
         assert(head);
@@ -304,7 +304,7 @@ static int dm_list_get(MountPoint **head) {
 
         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;
                 dev_t devnum;
                 const char *dn;
                 _cleanup_free_ MountPoint *m = NULL;
index 31087a0812df9141d2c83bd3d63732d87ef6389c..e66cfffbf2ff415ba9fc46b4d644e86ee2cc99fd 100644 (file)
@@ -458,8 +458,8 @@ static int add_esp(DissectedPartition *p) {
 #endif
 
 static int open_parent(dev_t devnum, int *ret) {
-        _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;
         const char *name, *devtype, *node;
         struct udev_device *parent;
         dev_t pn;
index 0a53788d2808aa37aefffc18c3de1a2d1902a771..6cd5e665625e23db64c77c79575ab64fe1bcd567 100644 (file)
@@ -32,7 +32,6 @@ Writer* writer_ref(Writer *w);
 Writer* writer_unref(Writer *w);
 
 DEFINE_TRIVIAL_CLEANUP_FUNC(Writer*, writer_unref);
-#define _cleanup_writer_unref_ _cleanup_(writer_unrefp)
 
 int writer_write(Writer *s,
                  struct iovec_wrapper *iovw,
index 995083655a8ab8c515304ad28e26844cf0c03d5e..81f30748e753fbf27b7059f6b44dab7ff66991af 100644 (file)
@@ -203,10 +203,9 @@ static int init_writer_hashmap(RemoteServer *s) {
         return 0;
 }
 
-static int get_writer(RemoteServer *s, const char *host,
-                      Writer **writer) {
+static int get_writer(RemoteServer *s, const char *host, Writer **writer) {
+        _cleanup_(writer_unrefp) Writer *w = NULL;
         const void *key;
-        _cleanup_writer_unref_ Writer *w = NULL;
         int r;
 
         switch(arg_split_mode) {
index 907f32bf8da6f6be35392fa4a1cc82f1d62d5cca..aa59489cff6673e970dfde1d3a2ce41fca6982a7 100644 (file)
@@ -182,8 +182,8 @@ typedef struct BootId {
 
 static int add_matches_for_device(sd_journal *j, const char *devpath) {
         int r;
-        _cleanup_udev_unref_ struct udev *udev = NULL;
-        _cleanup_udev_device_unref_ struct udev_device *device = NULL;
+        _cleanup_(udev_unrefp) struct udev *udev = NULL;
+        _cleanup_(udev_device_unrefp) struct udev_device *device = NULL;
         struct udev_device *d = NULL;
         struct stat st;
 
index 48afa8f4a6f86219f177568467c5c4b69fc2b62e..6a9dba1338cab4658ecd08f8d8e89ce3ab509c12 100644 (file)
@@ -78,13 +78,13 @@ int dhcp_identifier_set_duid_en(struct duid *duid, size_t *len) {
 int dhcp_identifier_set_iaid(int ifindex, uint8_t *mac, size_t mac_len, void *_id) {
         /* name is a pointer to memory in the udev_device struct, so must
            have the same scope */
-        _cleanup_udev_device_unref_ struct udev_device *device = NULL;
+        _cleanup_(udev_device_unrefp) struct udev_device *device = NULL;
         const char *name = NULL;
         uint64_t id;
 
         if (detect_container() <= 0) {
                 /* not in a container, udev will be around */
-                _cleanup_udev_unref_ struct udev *udev;
+                _cleanup_(udev_unrefp) struct udev *udev;
                 char ifindex_str[2 + DECIMAL_STR_MAX(int)];
 
                 udev = udev_new();
index b2baa72f49ea13ac47aaf0b85c4104232a542ded..351b56742386cc0d93d14151b076d6ac54c6132b 100644 (file)
@@ -645,7 +645,6 @@ static void dhcp_request_free(DHCPRequest *req) {
 }
 
 DEFINE_TRIVIAL_CLEANUP_FUNC(DHCPRequest*, dhcp_request_free);
-#define _cleanup_dhcp_request_free_ _cleanup_(dhcp_request_freep)
 
 static int ensure_sane_request(sd_dhcp_server *server, DHCPRequest *req, DHCPMessage *message) {
         assert(req);
@@ -698,7 +697,7 @@ static int get_pool_offset(sd_dhcp_server *server, be32_t requested_ip) {
 
 int dhcp_server_handle_message(sd_dhcp_server *server, DHCPMessage *message,
                                size_t length) {
-        _cleanup_dhcp_request_free_ DHCPRequest *req = NULL;
+        _cleanup_(dhcp_request_freep) DHCPRequest *req = NULL;
         _cleanup_free_ char *error_message = NULL;
         DHCPLease *existing_lease;
         int type, r;
index 178ba5cef615cfddbc7ae26c1c45ffa45fcea7f6..af3b4a4d2dce3cf984cc23271b077a8c5ea155fc 100644 (file)
@@ -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));
index 7f429aae416b419d854ab9f43f98ceaa8a600e1f..ff36bb1c4c7753f2cff4f869e6afc585eb47a07e 100644 (file)
@@ -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;
index d92437b67f3f023e9652263029b7d28b336bf112..bfa3f2d7d4e5b7a25ed75e921c99d1fc9bddf251 100644 (file)
@@ -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;
index 6bddcb541fc60a0212f6c49b78eee3f77a74909b..11ba08a1262dcdefd7e61c92aa668840c5c84e07 100644 (file)
@@ -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);
index ecef251d45268e77d207f29b406e8d4a4837f280..65993c49dd97566ffc9ae67903ef8a0fba7495bc 100644 (file)
@@ -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;
 
index e7878a6792ffa87c76ba7adf28aac0690f8f6ed8..02989301fe5f72f2b1026d8bbe78c55d083a2f11 100644 (file)
@@ -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));
index 3a6cf67df9df47e67fd0c201ae0540af154ad203..967c2dfc766f7f86a8ab8d55642dadb161c41d8e 100644 (file)
@@ -16,7 +16,7 @@
 
 /* callback for brige netdev's parameter set */
 static int netdev_bridge_set_handler(sd_netlink *rtnl, sd_netlink_message *m, void *userdata) {
-        _cleanup_netdev_unref_ NetDev *netdev = userdata;
+        _cleanup_(netdev_unrefp) NetDev *netdev = userdata;
         int r;
 
         assert(netdev);
index 03039439810e68bc73ad7f745f72a87baf9ff1ba..175acb4cfbc63d73dce52975d4cc485c12af299d 100644 (file)
@@ -23,7 +23,7 @@
 
 /* callback for geneve netdev's created without a backing Link */
 static int geneve_netdev_create_handler(sd_netlink *rtnl, sd_netlink_message *m, void *userdata) {
-        _cleanup_netdev_unref_ NetDev *netdev = userdata;
+        _cleanup_(netdev_unrefp) NetDev *netdev = userdata;
         int r;
 
         assert(netdev->state != _NETDEV_STATE_INVALID);
index af426aebd5fce360b8b838108e647cfebb376626..a0b26971836ca619c11be70079371f8e99d6d9a3 100644 (file)
@@ -285,7 +285,7 @@ static int netdev_enter_ready(NetDev *netdev) {
 
 /* callback for netdev's created without a backing Link */
 static int netdev_create_handler(sd_netlink *rtnl, sd_netlink_message *m, void *userdata) {
-        _cleanup_netdev_unref_ NetDev *netdev = userdata;
+        _cleanup_(netdev_unrefp) NetDev *netdev = userdata;
         int r;
 
         assert(netdev->state != _NETDEV_STATE_INVALID);
@@ -599,7 +599,7 @@ int netdev_join(NetDev *netdev, Link *link, sd_netlink_message_handler_t callbac
 }
 
 static int netdev_load_one(Manager *manager, const char *filename) {
-        _cleanup_netdev_unref_ NetDev *netdev_raw = NULL, *netdev = NULL;
+        _cleanup_(netdev_unrefp) NetDev *netdev_raw = NULL, *netdev = NULL;
         _cleanup_fclose_ FILE *file = NULL;
         const char *dropin_dirname;
         bool independent = false;
index 7adec38e38fb8a9b0afe836f7be0465d298a98af..2b01d4190f98f2e2711bf5d4575a182f386e479a 100644 (file)
@@ -156,7 +156,6 @@ NetDev *netdev_unref(NetDev *netdev);
 NetDev *netdev_ref(NetDev *netdev);
 
 DEFINE_TRIVIAL_CLEANUP_FUNC(NetDev*, netdev_unref);
-#define _cleanup_netdev_unref_ _cleanup_(netdev_unrefp)
 
 int netdev_get(Manager *manager, const char *name, NetDev **ret);
 int netdev_set_ifindex(NetDev *netdev, sd_netlink_message *newlink);
index 1e868ec2dec13c45c59a342ea023077b311f476d..6cdbd82561fa3c49c02ef6df2f0a1f5ce4ae3812 100644 (file)
@@ -17,7 +17,7 @@
 #include "socket-util.h"
 
 int address_label_new(AddressLabel **ret) {
-        _cleanup_address_label_free_ AddressLabel *addrlabel = NULL;
+        _cleanup_(address_label_freep) AddressLabel *addrlabel = NULL;
 
         addrlabel = new0(AddressLabel, 1);
         if (!addrlabel)
@@ -47,8 +47,8 @@ void address_label_free(AddressLabel *label) {
 }
 
 static int address_label_new_static(Network *network, const char *filename, unsigned section_line, AddressLabel **ret) {
-        _cleanup_network_config_section_free_ NetworkConfigSection *n = NULL;
-        _cleanup_address_label_free_ AddressLabel *label = NULL;
+        _cleanup_(network_config_section_freep) NetworkConfigSection *n = NULL;
+        _cleanup_(address_label_freep) AddressLabel *label = NULL;
         int r;
 
         assert(network);
@@ -137,7 +137,7 @@ int config_parse_address_label_prefix(const char *unit,
                                       void *data,
                                       void *userdata) {
 
-        _cleanup_address_label_free_ AddressLabel *n = NULL;
+        _cleanup_(address_label_freep) AddressLabel *n = NULL;
         Network *network = userdata;
         int r;
 
@@ -174,7 +174,7 @@ int config_parse_address_label(
                 void *data,
                 void *userdata) {
 
-        _cleanup_address_label_free_ AddressLabel *n = NULL;
+        _cleanup_(address_label_freep) AddressLabel *n = NULL;
         Network *network = userdata;
         uint32_t k;
         int r;
index 7d5e7609c86e75e9a6d82fa4b47228de69996cff..f4a805a87718bf9e73476d08dd53ff30eebff901 100644 (file)
@@ -38,7 +38,6 @@ int address_label_new(AddressLabel **ret);
 void address_label_free(AddressLabel *label);
 
 DEFINE_TRIVIAL_CLEANUP_FUNC(AddressLabel*, address_label_free);
-#define _cleanup_address_label_free_ _cleanup_(address_label_freep)
 
 int address_label_configure(AddressLabel *address, Link *link, sd_netlink_message_handler_t callback, bool update);
 
index 727eeda166d1c2c5b50a5c1e76dba191c8a3ace8..b77586959f64088cb88ad8c28622eed787359cc9 100644 (file)
@@ -24,7 +24,7 @@
 #define STATIC_ADDRESSES_PER_NETWORK_MAX 1024U
 
 int address_new(Address **ret) {
-        _cleanup_address_free_ Address *address = NULL;
+        _cleanup_(address_freep) Address *address = NULL;
 
         address = new0(Address, 1);
         if (!address)
@@ -41,8 +41,8 @@ int address_new(Address **ret) {
 }
 
 int address_new_static(Network *network, const char *filename, unsigned section_line, Address **ret) {
-        _cleanup_network_config_section_free_ NetworkConfigSection *n = NULL;
-        _cleanup_address_free_ Address *address = NULL;
+        _cleanup_(network_config_section_freep) NetworkConfigSection *n = NULL;
+        _cleanup_(address_freep) Address *address = NULL;
         int r;
 
         assert(network);
@@ -241,7 +241,7 @@ static int address_add_internal(Link *link, Set **addresses,
                                 const union in_addr_union *in_addr,
                                 unsigned char prefixlen,
                                 Address **ret) {
-        _cleanup_address_free_ Address *address = NULL;
+        _cleanup_(address_freep) Address *address = NULL;
         int r;
 
         assert(link);
@@ -471,7 +471,7 @@ int address_remove(
 static int address_acquire(Link *link, Address *original, Address **ret) {
         union in_addr_union in_addr = {};
         struct in_addr broadcast = {};
-        _cleanup_address_free_ Address *na = NULL;
+        _cleanup_(address_freep) Address *na = NULL;
         int r;
 
         assert(link);
@@ -667,7 +667,7 @@ int config_parse_broadcast(
                 void *userdata) {
 
         Network *network = userdata;
-        _cleanup_address_free_ Address *n = NULL;
+        _cleanup_(address_freep) Address *n = NULL;
         int r;
 
         assert(filename);
@@ -709,7 +709,7 @@ int config_parse_address(const char *unit,
                 void *userdata) {
 
         Network *network = userdata;
-        _cleanup_address_free_ Address *n = NULL;
+        _cleanup_(address_freep) Address *n = NULL;
         const char *address, *e;
         union in_addr_union buffer;
         int r, f;
@@ -795,7 +795,7 @@ int config_parse_label(
                 void *data,
                 void *userdata) {
 
-        _cleanup_address_free_ Address *n = NULL;
+        _cleanup_(address_freep) Address *n = NULL;
         Network *network = userdata;
         int r;
 
@@ -834,7 +834,7 @@ int config_parse_lifetime(const char *unit,
                           void *data,
                           void *userdata) {
         Network *network = userdata;
-        _cleanup_address_free_ Address *n = NULL;
+        _cleanup_(address_freep) Address *n = NULL;
         unsigned k;
         int r;
 
@@ -882,7 +882,7 @@ int config_parse_address_flags(const char *unit,
                                void *data,
                                void *userdata) {
         Network *network = userdata;
-        _cleanup_address_free_ Address *n = NULL;
+        _cleanup_(address_freep) Address *n = NULL;
         int r;
 
         assert(filename);
@@ -926,7 +926,7 @@ int config_parse_address_scope(const char *unit,
                                void *data,
                                void *userdata) {
         Network *network = userdata;
-        _cleanup_address_free_ Address *n = NULL;
+        _cleanup_(address_freep) Address *n = NULL;
         int r;
 
         assert(filename);
index bc8d068a8df4bf0147e5d047b37f21c4406210db..23ff94177080ef42490260cbf206e012a1d243c3 100644 (file)
@@ -65,7 +65,6 @@ bool address_equal(Address *a1, Address *a2);
 bool address_is_ready(const Address *a);
 
 DEFINE_TRIVIAL_CLEANUP_FUNC(Address*, address_free);
-#define _cleanup_address_free_ _cleanup_(address_freep)
 
 int config_parse_address(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
 int config_parse_broadcast(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
index 6bab7647d67b7ee96aa0e16d993be5d387f3b1d7..a1d300166bc56143a58a4cc0a7007993e1a73232 100644 (file)
@@ -22,7 +22,7 @@
 
 static int dhcp4_route_handler(sd_netlink *rtnl, sd_netlink_message *m,
                                void *userdata) {
-        _cleanup_link_unref_ Link *link = userdata;
+        _cleanup_(link_unrefp) Link *link = userdata;
         int r;
 
         assert(link);
@@ -98,7 +98,7 @@ static int link_set_dhcp_routes(Link *link) {
         }
 
         for (i = 0; i < n; i++) {
-                _cleanup_route_free_ Route *route = NULL;
+                _cleanup_(route_freep) Route *route = NULL;
 
                 /* if the DHCP server returns both a Classless Static Routes option and a Static Routes option,
                    the DHCP client MUST ignore the Static Routes option. */
@@ -137,8 +137,8 @@ static int link_set_dhcp_routes(Link *link) {
                 log_link_warning(link, "Classless static routes received from DHCP server: ignoring static-route option and router option");
 
         if (r >= 0 && !classless_route) {
-                _cleanup_route_free_ Route *route = NULL;
-                _cleanup_route_free_ Route *route_gw = NULL;
+                _cleanup_(route_freep) Route *route = NULL;
+                _cleanup_(route_freep) Route *route_gw = NULL;
 
                 r = route_new(&route);
                 if (r < 0)
@@ -188,7 +188,7 @@ static int link_set_dhcp_routes(Link *link) {
 }
 
 static int dhcp_lease_lost(Link *link) {
-        _cleanup_address_free_ Address *address = NULL;
+        _cleanup_(address_freep) Address *address = NULL;
         struct in_addr addr;
         struct in_addr netmask;
         struct in_addr gateway;
@@ -207,7 +207,7 @@ static int dhcp_lease_lost(Link *link) {
                 n = sd_dhcp_lease_get_routes(link->dhcp_lease, &routes);
                 if (n >= 0) {
                         for (i = 0; i < n; i++) {
-                                _cleanup_route_free_ Route *route = NULL;
+                                _cleanup_(route_freep) Route *route = NULL;
 
                                 r = route_new(&route);
                                 if (r >= 0) {
@@ -227,8 +227,8 @@ static int dhcp_lease_lost(Link *link) {
         if (r >= 0) {
                 r = sd_dhcp_lease_get_router(link->dhcp_lease, &gateway);
                 if (r >= 0) {
-                        _cleanup_route_free_ Route *route_gw = NULL;
-                        _cleanup_route_free_ Route *route = NULL;
+                        _cleanup_(route_freep) Route *route_gw = NULL;
+                        _cleanup_(route_freep) Route *route = NULL;
 
                         r = route_new(&route_gw);
                         if (r >= 0) {
@@ -305,7 +305,7 @@ static int dhcp_lease_lost(Link *link) {
 
 static int dhcp4_address_handler(sd_netlink *rtnl, sd_netlink_message *m,
                                  void *userdata) {
-        _cleanup_link_unref_ Link *link = userdata;
+        _cleanup_(link_unrefp) Link *link = userdata;
         int r;
 
         assert(link);
@@ -331,7 +331,7 @@ static int dhcp4_update_address(Link *link,
                                 struct in_addr *address,
                                 struct in_addr *netmask,
                                 uint32_t lifetime) {
-        _cleanup_address_free_ Address *addr = NULL;
+        _cleanup_(address_freep) Address *addr = NULL;
         unsigned prefixlen;
         int r;
 
index da38fbc45330b0e884dfbf2bcd00d36e7a48ee14..a2ccc6e494304a53f781a52dc151143fe062f703 100644 (file)
@@ -252,7 +252,7 @@ static int dhcp6_lease_pd_prefix_acquired(sd_dhcp6_client *client, Link *link) {
 
 static int dhcp6_address_handler(sd_netlink *rtnl, sd_netlink_message *m,
                                  void *userdata) {
-        _cleanup_link_unref_ Link *link = userdata;
+        _cleanup_(link_unrefp) Link *link = userdata;
         int r;
 
         assert(link);
@@ -284,7 +284,7 @@ static int dhcp6_address_change(
                 uint32_t lifetime_preferred,
                 uint32_t lifetime_valid) {
 
-        _cleanup_address_free_ Address *addr = NULL;
+        _cleanup_(address_freep) Address *addr = NULL;
         char buffer[INET6_ADDRSTRLEN];
         int r;
 
index c4fb7044e9ae94bf8cdf8448ff1fe0aecebe09d5..2cb014e83d83e7ddb9a2c7fe4081c342e9ddfe61 100644 (file)
@@ -25,7 +25,7 @@ int fdb_entry_new_static(
                 unsigned section,
                 FdbEntry **ret) {
 
-        _cleanup_fdbentry_free_ FdbEntry *fdb_entry = NULL;
+        _cleanup_(fdb_entry_freep) FdbEntry *fdb_entry = NULL;
         struct ether_addr *mac_addr = NULL;
 
         assert(network);
@@ -177,7 +177,7 @@ int config_parse_fdb_hwaddr(
                 void *userdata) {
 
         Network *network = userdata;
-        _cleanup_fdbentry_free_ FdbEntry *fdb_entry = NULL;
+        _cleanup_(fdb_entry_freep) FdbEntry *fdb_entry = NULL;
         int r;
 
         assert(filename);
@@ -223,7 +223,7 @@ int config_parse_fdb_vlan_id(
                 void *userdata) {
 
         Network *network = userdata;
-        _cleanup_fdbentry_free_ FdbEntry *fdb_entry = NULL;
+        _cleanup_(fdb_entry_freep) FdbEntry *fdb_entry = NULL;
         int r;
 
         assert(filename);
index 5479eb640b6bd129acf1e91d888fbf60222bc0f3..04bf69773ac299279ca143f2e9674ca5b21830e6 100644 (file)
@@ -29,7 +29,6 @@ void fdb_entry_free(FdbEntry *fdb_entry);
 int fdb_entry_configure(Link *link, FdbEntry *fdb_entry);
 
 DEFINE_TRIVIAL_CLEANUP_FUNC(FdbEntry*, fdb_entry_free);
-#define _cleanup_fdbentry_free_ _cleanup_(fdb_entry_freep)
 
 int config_parse_fdb_hwaddr(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
 int config_parse_fdb_vlan_id(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
index 1586e7428918f94234a8f06ba482b3c83d852fe9..2f2da8b5cef0b7789234a67823c3809d31531a06 100644 (file)
@@ -14,8 +14,8 @@
 #include "networkd-link.h"
 
 static int ipv4ll_address_lost(Link *link) {
-        _cleanup_address_free_ Address *address = NULL;
-        _cleanup_route_free_ Route *route = NULL;
+        _cleanup_(address_freep) Address *address = NULL;
+        _cleanup_(route_freep) Route *route = NULL;
         struct in_addr addr;
         int r;
 
@@ -61,7 +61,7 @@ static int ipv4ll_address_lost(Link *link) {
 }
 
 static int ipv4ll_route_handler(sd_netlink *rtnl, sd_netlink_message *m, void *userdata) {
-        _cleanup_link_unref_ Link *link = userdata;
+        _cleanup_(link_unrefp) Link *link = userdata;
         int r;
 
         assert(link);
@@ -82,7 +82,7 @@ static int ipv4ll_route_handler(sd_netlink *rtnl, sd_netlink_message *m, void *u
 }
 
 static int ipv4ll_address_handler(sd_netlink *rtnl, sd_netlink_message *m, void *userdata) {
-        _cleanup_link_unref_ Link *link = userdata;
+        _cleanup_(link_unrefp) Link *link = userdata;
         int r;
 
         assert(link);
@@ -104,8 +104,8 @@ static int ipv4ll_address_handler(sd_netlink *rtnl, sd_netlink_message *m, void
 }
 
 static int ipv4ll_address_claimed(sd_ipv4ll *ll, Link *link) {
-        _cleanup_address_free_ Address *ll_addr = NULL;
-        _cleanup_route_free_ Route *route = NULL;
+        _cleanup_(address_freep) Address *ll_addr = NULL;
+        _cleanup_(route_freep) Route *route = NULL;
         struct in_addr address;
         int r;
 
index e51ea88213cc4dd0c1e5a8821dfe71186b8c579b..6f5dcb843a3ad363df54a54109e140b23fa824ee 100644 (file)
@@ -404,7 +404,7 @@ static int link_update_flags(Link *link, sd_netlink_message *m) {
 }
 
 static int link_new(Manager *manager, sd_netlink_message *message, Link **ret) {
-        _cleanup_link_unref_ Link *link = NULL;
+        _cleanup_(link_unrefp) Link *link = NULL;
         uint16_t type;
         const char *ifname, *kind = NULL;
         int r, ifindex;
@@ -807,7 +807,7 @@ static int link_set_routing_policy_rule(Link *link) {
 }
 
 static int route_handler(sd_netlink *rtnl, sd_netlink_message *m, void *userdata) {
-        _cleanup_link_unref_ Link *link = userdata;
+        _cleanup_(link_unrefp) Link *link = userdata;
         int r;
 
         assert(link->route_messages > 0);
@@ -866,7 +866,7 @@ static int link_enter_set_routes(Link *link) {
 }
 
 int link_route_remove_handler(sd_netlink *rtnl, sd_netlink_message *m, void *userdata) {
-        _cleanup_link_unref_ Link *link = userdata;
+        _cleanup_(link_unrefp) Link *link = userdata;
         int r;
 
         assert(m);
@@ -884,7 +884,7 @@ int link_route_remove_handler(sd_netlink *rtnl, sd_netlink_message *m, void *use
 }
 
 static int address_handler(sd_netlink *rtnl, sd_netlink_message *m, void *userdata) {
-        _cleanup_link_unref_ Link *link = userdata;
+        _cleanup_(link_unrefp) Link *link = userdata;
         int r;
 
         assert(rtnl);
@@ -915,7 +915,7 @@ static int address_handler(sd_netlink *rtnl, sd_netlink_message *m, void *userda
 }
 
 static int address_label_handler(sd_netlink *rtnl, sd_netlink_message *m, void *userdata) {
-        _cleanup_link_unref_ Link *link = userdata;
+        _cleanup_(link_unrefp) Link *link = userdata;
         int r;
 
         assert(rtnl);
@@ -1217,7 +1217,7 @@ static int link_enter_set_addresses(Link *link) {
 }
 
 int link_address_remove_handler(sd_netlink *rtnl, sd_netlink_message *m, void *userdata) {
-        _cleanup_link_unref_ Link *link = userdata;
+        _cleanup_(link_unrefp) Link *link = userdata;
         int r;
 
         assert(m);
@@ -1261,7 +1261,7 @@ static int link_set_proxy_arp(Link *link) {
 }
 
 static int link_set_handler(sd_netlink *rtnl, sd_netlink_message *m, void *userdata) {
-        _cleanup_link_unref_ Link *link = userdata;
+        _cleanup_(link_unrefp) Link *link = userdata;
         int r;
 
         log_link_debug(link, "Set link");
@@ -1277,7 +1277,7 @@ static int link_set_handler(sd_netlink *rtnl, sd_netlink_message *m, void *userd
 }
 
 static int set_mtu_handler(sd_netlink *rtnl, sd_netlink_message *m, void *userdata) {
-        _cleanup_link_unref_ Link *link = userdata;
+        _cleanup_(link_unrefp) Link *link = userdata;
         int r;
 
         assert(m);
@@ -1324,7 +1324,7 @@ int link_set_mtu(Link *link, uint32_t mtu) {
 }
 
 static int set_flags_handler(sd_netlink *rtnl, sd_netlink_message *m, void *userdata) {
-        _cleanup_link_unref_ Link *link = userdata;
+        _cleanup_(link_unrefp) Link *link = userdata;
         int r;
 
         assert(m);
@@ -1703,7 +1703,7 @@ bool link_has_carrier(Link *link) {
 }
 
 static int link_up_handler(sd_netlink *rtnl, sd_netlink_message *m, void *userdata) {
-        _cleanup_link_unref_ Link *link = userdata;
+        _cleanup_(link_unrefp) Link *link = userdata;
         int r;
 
         assert(link);
@@ -1826,7 +1826,7 @@ int link_up(Link *link) {
 }
 
 static int link_down_handler(sd_netlink *rtnl, sd_netlink_message *m, void *userdata) {
-        _cleanup_link_unref_ Link *link = userdata;
+        _cleanup_(link_unrefp) Link *link = userdata;
         int r;
 
         assert(link);
@@ -2190,7 +2190,7 @@ static int link_joined(Link *link) {
 }
 
 static int netdev_join_handler(sd_netlink *rtnl, sd_netlink_message *m, void *userdata) {
-        _cleanup_link_unref_ Link *link = userdata;
+        _cleanup_(link_unrefp) Link *link = userdata;
         int r;
 
         assert(link);
@@ -2742,7 +2742,7 @@ static int link_configure(Link *link) {
 
 static int link_initialized_and_synced(sd_netlink *rtnl, sd_netlink_message *m,
                                        void *userdata) {
-        _cleanup_link_unref_ Link *link = userdata;
+        _cleanup_(link_unrefp) Link *link = userdata;
         Network *network;
         int r;
 
@@ -3033,7 +3033,7 @@ ipv4ll_address_fail:
 
 int link_add(Manager *m, sd_netlink_message *message, Link **ret) {
         Link *link;
-        _cleanup_udev_device_unref_ struct udev_device *device = NULL;
+        _cleanup_(udev_device_unrefp) struct udev_device *device = NULL;
         char ifindex_str[2 + DECIMAL_STR_MAX(int)];
         int r;
 
index a23dec575201ca6331d9349ef0cca2c61d11bed5..c17ac3f3ce71e4d4d4678160d96b100e73acfdf1 100644 (file)
@@ -179,7 +179,6 @@ int link_object_find(sd_bus *bus, const char *path, const char *interface, void
 int link_send_changed(Link *link, const char *property, ...) _sentinel_;
 
 DEFINE_TRIVIAL_CLEANUP_FUNC(Link*, link_unref);
-#define _cleanup_link_unref_ _cleanup_(link_unrefp)
 
 /* Macros which append INTERFACE= to the message */
 
index 0d85ba6e727db8f333c2f45fad46144db3aa2f9d..34c496f5521c7e9d83384b9b5407570705b2a8f7 100644 (file)
@@ -220,7 +220,7 @@ static int manager_udev_process_link(Manager *m, struct udev_device *device) {
 static int manager_dispatch_link_udev(sd_event_source *source, int fd, uint32_t revents, void *userdata) {
         Manager *m = userdata;
         struct udev_monitor *monitor = m->udev_monitor;
-        _cleanup_udev_device_unref_ struct udev_device *device = NULL;
+        _cleanup_(udev_device_unrefp) struct udev_device *device = NULL;
 
         device = udev_monitor_receive_device(monitor);
         if (!device)
@@ -1376,7 +1376,7 @@ static const struct hash_ops dhcp6_prefixes_hash_ops = {
 };
 
 int manager_new(Manager **ret, sd_event *event) {
-        _cleanup_manager_free_ Manager *m = NULL;
+        _cleanup_(manager_freep) Manager *m = NULL;
         int r;
 
         m = new0(Manager, 1);
index b1d6585df2c0f1e19c577183c2dc0552b5a084ef..01705f4ae3350b1f7c7e60fa934d14d7c7aad71f 100644 (file)
@@ -107,4 +107,3 @@ int manager_dhcp6_prefix_remove(Manager *m, struct in6_addr *addr);
 int manager_dhcp6_prefix_remove_all(Manager *m, Link *link);
 
 DEFINE_TRIVIAL_CLEANUP_FUNC(Manager*, manager_free);
-#define _cleanup_manager_free_ _cleanup_(manager_freep)
index 80e8f5891b942952ca8f9e310628881e7765adbb..63b047e4dd10264eb7656f8b2ccf177678694746 100644 (file)
@@ -18,7 +18,7 @@
 #define NDISC_PREFIX_LFT_MIN 7200U
 
 static int ndisc_netlink_handler(sd_netlink *rtnl, sd_netlink_message *m, void *userdata) {
-        _cleanup_link_unref_ Link *link = userdata;
+        _cleanup_(link_unrefp) Link *link = userdata;
         int r;
 
         assert(link);
@@ -39,7 +39,7 @@ static int ndisc_netlink_handler(sd_netlink *rtnl, sd_netlink_message *m, void *
 }
 
 static void ndisc_router_process_default(Link *link, sd_ndisc_router *rt) {
-        _cleanup_route_free_ Route *route = NULL;
+        _cleanup_(route_freep) Route *route = NULL;
         struct in6_addr gateway;
         uint16_t lifetime;
         unsigned preference;
@@ -138,7 +138,7 @@ static void ndisc_router_process_default(Link *link, sd_ndisc_router *rt) {
 }
 
 static void ndisc_router_process_autonomous_prefix(Link *link, sd_ndisc_router *rt) {
-        _cleanup_address_free_ Address *address = NULL;
+        _cleanup_(address_freep) Address *address = NULL;
         Address *existing_address;
         uint32_t lifetime_valid, lifetime_preferred, lifetime_remaining;
         usec_t time_now;
@@ -236,7 +236,7 @@ static void ndisc_router_process_autonomous_prefix(Link *link, sd_ndisc_router *
 }
 
 static void ndisc_router_process_onlink_prefix(Link *link, sd_ndisc_router *rt) {
-        _cleanup_route_free_ Route *route = NULL;
+        _cleanup_(route_freep) Route *route = NULL;
         usec_t time_now;
         uint32_t lifetime;
         unsigned prefixlen;
@@ -294,7 +294,7 @@ static void ndisc_router_process_onlink_prefix(Link *link, sd_ndisc_router *rt)
 }
 
 static void ndisc_router_process_route(Link *link, sd_ndisc_router *rt) {
-        _cleanup_route_free_ Route *route = NULL;
+        _cleanup_(route_freep) Route *route = NULL;
         struct in6_addr gateway;
         uint32_t lifetime;
         unsigned preference, prefixlen;
index 17d6a62983540a266363ea93de7f75d26405ad89..03dfd4e510b1e0bfab3d9db4bff19b3bc1f237bb 100644 (file)
@@ -109,7 +109,7 @@ void network_apply_anonymize_if_set(Network *network) {
 }
 
 static int network_load_one(Manager *manager, const char *filename) {
-        _cleanup_network_free_ Network *network = NULL;
+        _cleanup_(network_freep) Network *network = NULL;
         _cleanup_fclose_ FILE *file = NULL;
         char *d;
         const char *dropin_dirname;
index c34788d620086cc327569ca912f48b4f4ecaa402..f58c2d32d3693fe73cb704752d84ff15e0ef23e2 100644 (file)
@@ -96,7 +96,6 @@ int network_config_section_new(const char *filename, unsigned line, NetworkConfi
 void network_config_section_free(NetworkConfigSection *network);
 
 DEFINE_TRIVIAL_CLEANUP_FUNC(NetworkConfigSection*, network_config_section_free);
-#define _cleanup_network_config_section_free_ _cleanup_(network_config_section_freep)
 
 typedef struct Manager Manager;
 
@@ -264,7 +263,6 @@ struct Network {
 void network_free(Network *network);
 
 DEFINE_TRIVIAL_CLEANUP_FUNC(Network*, network_free);
-#define _cleanup_network_free_ _cleanup_(network_freep)
 
 int network_load(Manager *manager);
 
index 1273ed53de071707fe354fd50691afaa2e5567e3..464e636876d2b25bdeb51bf1b57b7bdbac5dfa21 100644 (file)
@@ -120,8 +120,8 @@ int prefix_new(Prefix **ret) {
 
 int prefix_new_static(Network *network, const char *filename,
                       unsigned section_line, Prefix **ret) {
-        _cleanup_network_config_section_free_ NetworkConfigSection *n = NULL;
-        _cleanup_prefix_free_ Prefix *prefix = NULL;
+        _cleanup_(network_config_section_freep) NetworkConfigSection *n = NULL;
+        _cleanup_(prefix_freep) Prefix *prefix = NULL;
         int r;
 
         assert(network);
@@ -177,7 +177,7 @@ int config_parse_prefix(const char *unit,
                 void *userdata) {
 
         Network *network = userdata;
-        _cleanup_prefix_free_ Prefix *p = NULL;
+        _cleanup_(prefix_freep) Prefix *p = NULL;
         uint8_t prefixlen = 64;
         union in_addr_union in6addr;
         int r;
@@ -219,7 +219,7 @@ int config_parse_prefix_flags(const char *unit,
                               void *data,
                               void *userdata) {
         Network *network = userdata;
-        _cleanup_prefix_free_ Prefix *p = NULL;
+        _cleanup_(prefix_freep) Prefix *p = NULL;
         int r, val;
 
         assert(filename);
@@ -263,7 +263,7 @@ int config_parse_prefix_lifetime(const char *unit,
                                  void *data,
                                  void *userdata) {
         Network *network = userdata;
-        _cleanup_prefix_free_ Prefix *p = NULL;
+        _cleanup_(prefix_freep) Prefix *p = NULL;
         usec_t usec;
         int r;
 
index 362f108f1798dc41c1b3c3d1faa955d50103b99f..1e3be1f924c568514d093631e27b9d7f44903125 100644 (file)
@@ -27,7 +27,6 @@ int prefix_new_static(Network *network, const char *filename, unsigned section,
                       Prefix **ret);
 
 DEFINE_TRIVIAL_CLEANUP_FUNC(Prefix*, prefix_free);
-#define _cleanup_prefix_free_ _cleanup_(prefix_freep)
 
 int config_parse_router_prefix_delegation(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
 int config_parse_router_preference(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
index af7009c4c5b157b66271675f8bc4b1081360f9c9..3c5127bb8871c502aeffa344f79ad4347371e972 100644 (file)
@@ -49,7 +49,7 @@ static unsigned routes_max(void) {
 }
 
 int route_new(Route **ret) {
-        _cleanup_route_free_ Route *route = NULL;
+        _cleanup_(route_freep) Route *route = NULL;
 
         route = new0(Route, 1);
         if (!route)
@@ -69,8 +69,8 @@ int route_new(Route **ret) {
 }
 
 int route_new_static(Network *network, const char *filename, unsigned section_line, Route **ret) {
-        _cleanup_network_config_section_free_ NetworkConfigSection *n = NULL;
-        _cleanup_route_free_ Route *route = NULL;
+        _cleanup_(network_config_section_freep) NetworkConfigSection *n = NULL;
+        _cleanup_(route_freep) Route *route = NULL;
         int r;
 
         assert(network);
@@ -261,7 +261,7 @@ static int route_add_internal(
                 uint32_t table,
                 Route **ret) {
 
-        _cleanup_route_free_ Route *route = NULL;
+        _cleanup_(route_freep) Route *route = NULL;
         int r;
 
         assert(link);
@@ -689,7 +689,7 @@ int config_parse_gateway(const char *unit,
                 void *userdata) {
 
         Network *network = userdata;
-        _cleanup_route_free_ Route *n = NULL;
+        _cleanup_(route_freep) Route *n = NULL;
         union in_addr_union buffer;
         int r, f;
 
@@ -734,7 +734,7 @@ int config_parse_preferred_src(const char *unit,
                 void *userdata) {
 
         Network *network = userdata;
-        _cleanup_route_free_ Route *n = NULL;
+        _cleanup_(route_freep) Route *n = NULL;
         union in_addr_union buffer;
         int r, f;
 
@@ -774,7 +774,7 @@ int config_parse_destination(const char *unit,
                 void *userdata) {
 
         Network *network = userdata;
-        _cleanup_route_free_ Route *n = NULL;
+        _cleanup_(route_freep) Route *n = NULL;
         union in_addr_union buffer;
         unsigned char prefixlen;
         int r;
@@ -828,7 +828,7 @@ int config_parse_route_priority(const char *unit,
                                 void *data,
                                 void *userdata) {
         Network *network = userdata;
-        _cleanup_route_free_ Route *n = NULL;
+        _cleanup_(route_freep) Route *n = NULL;
         uint32_t k;
         int r;
 
@@ -866,7 +866,7 @@ int config_parse_route_scope(const char *unit,
                              void *data,
                              void *userdata) {
         Network *network = userdata;
-        _cleanup_route_free_ Route *n = NULL;
+        _cleanup_(route_freep) Route *n = NULL;
         int r;
 
         assert(filename);
@@ -905,7 +905,7 @@ int config_parse_route_table(const char *unit,
                              const char *rvalue,
                              void *data,
                              void *userdata) {
-        _cleanup_route_free_ Route *n = NULL;
+        _cleanup_(route_freep) Route *n = NULL;
         Network *network = userdata;
         uint32_t k;
         int r;
@@ -945,7 +945,7 @@ int config_parse_gateway_onlink(const char *unit,
                                 void *data,
                                 void *userdata) {
         Network *network = userdata;
-        _cleanup_route_free_ Route *n = NULL;
+        _cleanup_(route_freep) Route *n = NULL;
         int r;
 
         assert(filename);
@@ -982,7 +982,7 @@ int config_parse_ipv6_route_preference(const char *unit,
                                        void *data,
                                        void *userdata) {
         Network *network = userdata;
-        _cleanup_route_free_ Route *n = NULL;
+        _cleanup_(route_freep) Route *n = NULL;
         int r;
 
         r = route_new_static(network, filename, section_line, &n);
@@ -1016,7 +1016,7 @@ int config_parse_route_protocol(const char *unit,
                                 void *data,
                                 void *userdata) {
         Network *network = userdata;
-        _cleanup_route_free_ Route *n = NULL;
+        _cleanup_(route_freep) Route *n = NULL;
         int r;
 
         r = route_new_static(network, filename, section_line, &n);
@@ -1053,7 +1053,7 @@ int config_parse_route_type(const char *unit,
                             void *data,
                             void *userdata) {
         Network *network = userdata;
-        _cleanup_route_free_ Route *n = NULL;
+        _cleanup_(route_freep) Route *n = NULL;
         int r;
 
         r = route_new_static(network, filename, section_line, &n);
@@ -1088,7 +1088,7 @@ int config_parse_tcp_window(const char *unit,
                              const char *rvalue,
                              void *data,
                              void *userdata) {
-        _cleanup_route_free_ Route *n = NULL;
+        _cleanup_(route_freep) Route *n = NULL;
         Network *network = userdata;
         uint64_t k;
         int r;
@@ -1134,7 +1134,7 @@ int config_parse_quickack(const char *unit,
                           const char *rvalue,
                           void *data,
                           void *userdata) {
-        _cleanup_route_free_ Route *n = NULL;
+        _cleanup_(route_freep) Route *n = NULL;
         Network *network = userdata;
         int k, r;
 
index 169476e6a40ceb417656bc4a2aa365fd03a0ff1d..cda6d582050804495e7672d65fd38b8532888755 100644 (file)
@@ -60,7 +60,6 @@ void route_update(Route *route, const union in_addr_union *src, unsigned char sr
 int route_expire_handler(sd_event_source *s, uint64_t usec, void *userdata);
 
 DEFINE_TRIVIAL_CLEANUP_FUNC(Route*, route_free);
-#define _cleanup_route_free_ _cleanup_(route_freep)
 
 int config_parse_gateway(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
 int config_parse_preferred_src(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
index 0fb79c1deb2a56176225836d043f105c0ace7642..0abb8803b7ae16dc40c30aec4aafa7c918ce8de1 100644 (file)
@@ -238,7 +238,7 @@ static int routing_policy_rule_add_internal(Manager *m,
                                             char *oif,
                                             RoutingPolicyRule **ret) {
 
-        _cleanup_routing_policy_rule_free_ RoutingPolicyRule *rule = NULL;
+        _cleanup_(routing_policy_rule_freep) RoutingPolicyRule *rule = NULL;
         int r;
 
         assert_return(rules, -EINVAL);
@@ -307,7 +307,7 @@ int routing_policy_rule_add_foreign(Manager *m,
 }
 
 static int routing_policy_rule_remove_handler(sd_netlink *rtnl, sd_netlink_message *m, void *userdata) {
-        _cleanup_link_unref_ Link *link = userdata;
+        _cleanup_(link_unrefp) Link *link = userdata;
         int r;
 
         assert(m);
@@ -379,8 +379,8 @@ int routing_policy_rule_remove(RoutingPolicyRule *routing_policy_rule, Link *lin
 }
 
 static int routing_policy_rule_new_static(Network *network, const char *filename, unsigned section_line, RoutingPolicyRule **ret) {
-        _cleanup_routing_policy_rule_free_ RoutingPolicyRule *rule = NULL;
-        _cleanup_network_config_section_free_ NetworkConfigSection *n = NULL;
+        _cleanup_(routing_policy_rule_freep) RoutingPolicyRule *rule = NULL;
+        _cleanup_(network_config_section_freep) NetworkConfigSection *n = NULL;
         int r;
 
         assert(network);
@@ -419,7 +419,7 @@ static int routing_policy_rule_new_static(Network *network, const char *filename
 }
 
 int link_routing_policy_rule_handler(sd_netlink *rtnl, sd_netlink_message *m, void *userdata) {
-        _cleanup_link_unref_ Link *link = userdata;
+        _cleanup_(link_unrefp) Link *link = userdata;
         int r;
 
         assert(rtnl);
@@ -592,7 +592,7 @@ int config_parse_routing_policy_rule_tos(
                 void *data,
                 void *userdata) {
 
-        _cleanup_routing_policy_rule_free_ RoutingPolicyRule *n = NULL;
+        _cleanup_(routing_policy_rule_freep) RoutingPolicyRule *n = NULL;
         Network *network = userdata;
         int r;
 
@@ -629,7 +629,7 @@ int config_parse_routing_policy_rule_priority(
                 void *data,
                 void *userdata) {
 
-        _cleanup_routing_policy_rule_free_ RoutingPolicyRule *n = NULL;
+        _cleanup_(routing_policy_rule_freep) RoutingPolicyRule *n = NULL;
         Network *network = userdata;
         int r;
 
@@ -666,7 +666,7 @@ int config_parse_routing_policy_rule_table(
                 void *data,
                 void *userdata) {
 
-        _cleanup_routing_policy_rule_free_ RoutingPolicyRule *n = NULL;
+        _cleanup_(routing_policy_rule_freep) RoutingPolicyRule *n = NULL;
         Network *network = userdata;
         int r;
 
@@ -703,7 +703,7 @@ int config_parse_routing_policy_rule_fwmark_mask(
                 void *data,
                 void *userdata) {
 
-        _cleanup_routing_policy_rule_free_ RoutingPolicyRule *n = NULL;
+        _cleanup_(routing_policy_rule_freep) RoutingPolicyRule *n = NULL;
         Network *network = userdata;
         int r;
 
@@ -740,7 +740,7 @@ int config_parse_routing_policy_rule_prefix(
                 void *data,
                 void *userdata) {
 
-        _cleanup_routing_policy_rule_free_ RoutingPolicyRule *n = NULL;
+        _cleanup_(routing_policy_rule_freep) RoutingPolicyRule *n = NULL;
         Network *network = userdata;
         union in_addr_union buffer;
         uint8_t prefixlen;
@@ -793,7 +793,7 @@ int config_parse_routing_policy_rule_device(
                 void *data,
                 void *userdata) {
 
-        _cleanup_routing_policy_rule_free_ RoutingPolicyRule *n = NULL;
+        _cleanup_(routing_policy_rule_freep) RoutingPolicyRule *n = NULL;
         Network *network = userdata;
         int r;
 
@@ -940,7 +940,7 @@ int routing_policy_load_rules(const char *state_file, Set **rules) {
                 return r;
 
         STRV_FOREACH(i, l) {
-                _cleanup_routing_policy_rule_free_ RoutingPolicyRule *rule = NULL;
+                _cleanup_(routing_policy_rule_freep) RoutingPolicyRule *rule = NULL;
 
                 p = startswith(*i, "RULE=");
                 if (!p)
index 102dd70586e39e33d9ae8a24948f5f44b30eedf9..f176d9a088619b82f9dafef2a3ebeedee91eb9d6 100644 (file)
@@ -52,7 +52,6 @@ int routing_policy_rule_new(RoutingPolicyRule **ret);
 void routing_policy_rule_free(RoutingPolicyRule *rule);
 
 DEFINE_TRIVIAL_CLEANUP_FUNC(RoutingPolicyRule*, routing_policy_rule_free);
-#define _cleanup_routing_policy_rule_free_ _cleanup_(routing_policy_rule_freep)
 
 int routing_policy_rule_configure(RoutingPolicyRule *address, Link *link, sd_netlink_message_handler_t callback, bool update);
 int routing_policy_rule_remove(RoutingPolicyRule *routing_policy_rule, Link *link, sd_netlink_message_handler_t callback);
index 48bc9820a9b2f31374c1a2646c238b7bece0b892..4100b4c219d7f456f9db0fd57756f4d6bd78b547 100644 (file)
@@ -16,7 +16,7 @@
 
 int main(int argc, char *argv[]) {
         sd_event *event = NULL;
-        _cleanup_manager_free_ Manager *m = NULL;
+        _cleanup_(manager_freep) Manager *m = NULL;
         const char *user = "systemd-network";
         uid_t uid;
         gid_t gid;
index 5ca7550457140014b7eb346fcb0fe26f6d3b2fb1..3ffc4b95ab2b9811a4727362d5edb8bd9705e759 100644 (file)
@@ -133,7 +133,7 @@ static void test_network_get(Manager *manager, struct udev_device *loopback) {
 }
 
 static void test_address_equality(void) {
-        _cleanup_address_free_ Address *a1 = NULL, *a2 = NULL;
+        _cleanup_(address_freep) Address *a1 = NULL, *a2 = NULL;
 
         assert_se(address_new(&a1) >= 0);
         assert_se(address_new(&a2) >= 0);
@@ -223,10 +223,10 @@ static void test_dhcp_hostname_shorten_overlong(void) {
 }
 
 int main(void) {
-        _cleanup_manager_free_ Manager *manager = NULL;
+        _cleanup_(manager_freep) Manager *manager = NULL;
         _cleanup_(sd_event_unrefp) sd_event *event = NULL;
-        _cleanup_udev_unref_ struct udev *udev = NULL;
-        _cleanup_udev_device_unref_ struct udev_device *loopback = NULL;
+        _cleanup_(udev_unrefp) struct udev *udev = NULL;
+        _cleanup_(udev_device_unrefp) struct udev_device *loopback = NULL;
         int r;
 
         test_deserialize_in_addr();
index 90852b9c757de869e2d782e5df15c33dcf2e1774..bb30ea6154d7420b114fb1a83a0272283e4c6173 100644 (file)
@@ -325,7 +325,7 @@ static int create_bridge(sd_netlink *rtnl, const char *bridge_name) {
 }
 
 int setup_bridge(const char *veth_name, const char *bridge_name, bool create) {
-        _cleanup_release_lock_file_ LockFile bridge_lock = LOCK_FILE_INIT;
+        _cleanup_(release_lock_file) LockFile bridge_lock = LOCK_FILE_INIT;
         _cleanup_(sd_netlink_unrefp) sd_netlink *rtnl = NULL;
         int r, bridge_ifi;
         unsigned n = 0;
@@ -366,7 +366,7 @@ int setup_bridge(const char *veth_name, const char *bridge_name, bool create) {
 }
 
 int remove_bridge(const char *bridge_name) {
-        _cleanup_release_lock_file_ LockFile bridge_lock = LOCK_FILE_INIT;
+        _cleanup_(release_lock_file) LockFile bridge_lock = LOCK_FILE_INIT;
         _cleanup_(sd_netlink_unrefp) sd_netlink *rtnl = NULL;
         const char *path;
         int r;
@@ -398,7 +398,7 @@ int remove_bridge(const char *bridge_name) {
 }
 
 static int parse_interface(struct udev *udev, const char *name) {
-        _cleanup_udev_device_unref_ struct udev_device *d = NULL;
+        _cleanup_(udev_device_unrefp) struct udev_device *d = NULL;
         char ifi_str[2 + DECIMAL_STR_MAX(int)];
         int ifi;
 
@@ -420,7 +420,7 @@ static int parse_interface(struct udev *udev, const char *name) {
 }
 
 int move_network_interfaces(pid_t pid, char **ifaces) {
-        _cleanup_udev_unref_ struct udev *udev = NULL;
+        _cleanup_(udev_unrefp) struct udev *udev = NULL;
         _cleanup_(sd_netlink_unrefp) sd_netlink *rtnl = NULL;
         char **i;
         int r;
@@ -463,7 +463,7 @@ int move_network_interfaces(pid_t pid, char **ifaces) {
 }
 
 int setup_macvlan(const char *machine_name, pid_t pid, char **ifaces) {
-        _cleanup_udev_unref_ struct udev *udev = NULL;
+        _cleanup_(udev_unrefp) struct udev *udev = NULL;
         _cleanup_(sd_netlink_unrefp) sd_netlink *rtnl = NULL;
         unsigned idx = 0;
         char **i;
@@ -551,7 +551,7 @@ int setup_macvlan(const char *machine_name, pid_t pid, char **ifaces) {
 }
 
 int setup_ipvlan(const char *machine_name, pid_t pid, char **ifaces) {
-        _cleanup_udev_unref_ struct udev *udev = NULL;
+        _cleanup_(udev_unrefp) struct udev *udev = NULL;
         _cleanup_(sd_netlink_unrefp) sd_netlink *rtnl = NULL;
         char **i;
         int r;
index 81ffe7b91e713baa2c0cf981d01419ab0c5002e9..814a514be6bf1507e889b35b28c77d528a8476d9 100644 (file)
@@ -2878,7 +2878,7 @@ static int uid_shift_pick(uid_t *shift, LockFile *ret_lock_file) {
 
         for (;;) {
                 char lock_path[STRLEN("/run/systemd/nspawn-uid/") + DECIMAL_STR_MAX(uid_t) + 1];
-                _cleanup_release_lock_file_ LockFile lf = LOCK_FILE_INIT;
+                _cleanup_(release_lock_file) LockFile lf = LOCK_FILE_INIT;
 
                 if (--n_tries <= 0)
                         return -EBUSY;
@@ -3286,7 +3286,7 @@ static int run(int master,
                 .sa_flags = SA_NOCLDSTOP|SA_RESTART,
         };
 
-        _cleanup_release_lock_file_ LockFile uid_shift_lock = LOCK_FILE_INIT;
+        _cleanup_(release_lock_file) LockFile uid_shift_lock = LOCK_FILE_INIT;
         _cleanup_close_ int etc_passwd_lock = -1;
         _cleanup_close_pair_ int
                 kmsg_socket_pair[2] = { -1, -1 },
@@ -3791,7 +3791,7 @@ int main(int argc, char *argv[]) {
         bool secondary = false, remove_directory = false, remove_image = false;
         pid_t pid = 0;
         union in_addr_union exposed = {};
-        _cleanup_release_lock_file_ LockFile tree_global_lock = LOCK_FILE_INIT, tree_local_lock = LOCK_FILE_INIT;
+        _cleanup_(release_lock_file) LockFile tree_global_lock = LOCK_FILE_INIT, tree_local_lock = LOCK_FILE_INIT;
         bool interactive, veth_created = false, remove_tmprootdir = false;
         char tmprootdir[] = "/tmp/nspawn-root-XXXXXX";
         _cleanup_(loop_device_unrefp) LoopDevice *loop = NULL;
index 06a71162f6eebafd03fc2efb347c966ae158c6ac..330c4e8629b1ee2a8a73c3df0a1ae7196f4ddb7e 100644 (file)
@@ -97,7 +97,7 @@ static int wait_for_initialized(
                 struct udev_device *device,
                 struct udev_device **ret) {
 
-        _cleanup_udev_monitor_unref_ struct udev_monitor *monitor = NULL;
+        _cleanup_(udev_monitor_unrefp) struct udev_monitor *monitor = NULL;
         struct udev_device *d;
         const char *sysname;
         int watch_fd, r;
@@ -144,7 +144,7 @@ static int wait_for_initialized(
         }
 
         for (;;) {
-                _cleanup_udev_device_unref_ struct udev_device *t = NULL;
+                _cleanup_(udev_device_unrefp) struct udev_device *t = NULL;
 
                 r = fd_wait_for_event(watch_fd, POLLIN, EXIT_USEC);
                 if (r == -EINTR)
@@ -172,8 +172,8 @@ static int determine_state_file(
                 const struct rfkill_event *event,
                 char **ret) {
 
-        _cleanup_udev_device_unref_ struct udev_device *d = NULL;
-        _cleanup_udev_device_unref_ struct udev_device *device = NULL;
+        _cleanup_(udev_device_unrefp) struct udev_device *d = NULL;
+        _cleanup_(udev_device_unrefp) struct udev_device *device = NULL;
         const char *path_id, *type;
         char *state_file;
         int r;
@@ -363,7 +363,7 @@ static int save_state_write(struct write_queue_item **write_queue) {
 
 int main(int argc, char *argv[]) {
         LIST_HEAD(write_queue_item, write_queue);
-        _cleanup_udev_unref_ struct udev *udev = NULL;
+        _cleanup_(udev_unrefp) struct udev *udev = NULL;
         _cleanup_close_ int rfkill_fd = -1;
         bool ready = false;
         int r, n;
index 421c8f293ea58de2c0330dbbe3ac1f91fcad0ada..de232309c2f686c638ed9b950dd462a92aa6efec 100644 (file)
@@ -397,7 +397,7 @@ static int verify_esp(
                 uint64_t *ret_psize,
                 sd_id128_t *ret_uuid) {
 #if HAVE_BLKID
-        _cleanup_blkid_free_probe_ blkid_probe b = NULL;
+        _cleanup_(blkid_free_probep) blkid_probe b = NULL;
         char t[DEV_NUM_PATH_MAX];
         const char *v;
 #endif
index 61926e410d059a5c4f22bd5a40a7691136e3fd42..14e905b2d909e17984cc4ceeb408bcabf9409c69 100644 (file)
@@ -49,7 +49,7 @@ int probe_filesystem(const char *node, char **ret_fstype) {
          * different error otherwise. */
 
 #if HAVE_BLKID
-        _cleanup_blkid_free_probe_ blkid_probe b = NULL;
+        _cleanup_(blkid_free_probep) blkid_probe b = NULL;
         const char *fstype;
         int r;
 
@@ -124,12 +124,12 @@ int dissect_image(
 
 #if HAVE_BLKID
         sd_id128_t root_uuid = SD_ID128_NULL, verity_uuid = SD_ID128_NULL;
-        _cleanup_udev_enumerate_unref_ struct udev_enumerate *e = NULL;
+        _cleanup_(udev_enumerate_unrefp) struct udev_enumerate *e = NULL;
         bool is_gpt, is_mbr, generic_rw, multiple_generic = false;
-        _cleanup_udev_device_unref_ struct udev_device *d = NULL;
+        _cleanup_(udev_device_unrefp) struct udev_device *d = NULL;
         _cleanup_(dissected_image_unrefp) DissectedImage *m = NULL;
-        _cleanup_blkid_free_probe_ blkid_probe b = NULL;
-        _cleanup_udev_unref_ struct udev *udev = NULL;
+        _cleanup_(blkid_free_probep) blkid_probe b = NULL;
+        _cleanup_(udev_unrefp) struct udev *udev = NULL;
         _cleanup_free_ char *generic_node = NULL;
         sd_id128_t generic_uuid = SD_ID128_NULL;
         const char *pttype = NULL;
@@ -287,7 +287,7 @@ int dissect_image(
                 n = 0;
                 first = udev_enumerate_get_list_entry(e);
                 udev_list_entry_foreach(item, first) {
-                        _cleanup_udev_device_unref_ struct udev_device *q;
+                        _cleanup_(udev_device_unrefp) struct udev_device *q;
                         dev_t qn;
 
                         q = udev_device_new_from_syspath(udev, udev_list_entry_get_name(item));
@@ -360,7 +360,7 @@ int dissect_image(
 
         first = udev_enumerate_get_list_entry(e);
         udev_list_entry_foreach(item, first) {
-                _cleanup_udev_device_unref_ struct udev_device *q;
+                _cleanup_(udev_device_unrefp) struct udev_device *q;
                 unsigned long long pflags;
                 blkid_partition pp;
                 const char *node;
index db4366526cfb8b681f0d65545c67a16b3eed0ed9..98a289cc65b68cad6ef8d8fa2cb48c1c0c2503df 100644 (file)
@@ -1992,7 +1992,7 @@ int unit_file_mask(
                 UnitFileChange **changes,
                 unsigned *n_changes) {
 
-        _cleanup_lookup_paths_free_ LookupPaths paths = {};
+        _cleanup_(lookup_paths_free) LookupPaths paths = {};
         const char *config_path;
         char **i;
         int r;
@@ -2038,7 +2038,7 @@ int unit_file_unmask(
                 UnitFileChange **changes,
                 unsigned *n_changes) {
 
-        _cleanup_lookup_paths_free_ LookupPaths paths = {};
+        _cleanup_(lookup_paths_free) LookupPaths paths = {};
         _cleanup_set_free_free_ Set *remove_symlinks_to = NULL;
         _cleanup_strv_free_ char **todo = NULL;
         size_t n_todo = 0, n_allocated = 0;
@@ -2132,7 +2132,7 @@ int unit_file_link(
                 UnitFileChange **changes,
                 unsigned *n_changes) {
 
-        _cleanup_lookup_paths_free_ LookupPaths paths = {};
+        _cleanup_(lookup_paths_free) LookupPaths paths = {};
         _cleanup_strv_free_ char **todo = NULL;
         size_t n_todo = 0, n_allocated = 0;
         const char *config_path;
@@ -2233,7 +2233,7 @@ int unit_file_revert(
                 unsigned *n_changes) {
 
         _cleanup_set_free_free_ Set *remove_symlinks_to = NULL;
-        _cleanup_lookup_paths_free_ LookupPaths paths = {};
+        _cleanup_(lookup_paths_free) LookupPaths paths = {};
         _cleanup_strv_free_ char **todo = NULL;
         size_t n_todo = 0, n_allocated = 0;
         char **i;
@@ -2389,7 +2389,7 @@ int unit_file_add_dependency(
                 UnitFileChange **changes,
                 unsigned *n_changes) {
 
-        _cleanup_lookup_paths_free_ LookupPaths paths = {};
+        _cleanup_(lookup_paths_free) LookupPaths paths = {};
         _cleanup_(install_context_done) InstallContext c = {};
         UnitFileInstallInfo *i, *target_info;
         const char *config_path;
@@ -2463,7 +2463,7 @@ int unit_file_enable(
                 UnitFileChange **changes,
                 unsigned *n_changes) {
 
-        _cleanup_lookup_paths_free_ LookupPaths paths = {};
+        _cleanup_(lookup_paths_free) LookupPaths paths = {};
         _cleanup_(install_context_done) InstallContext c = {};
         const char *config_path;
         UnitFileInstallInfo *i;
@@ -2509,7 +2509,7 @@ int unit_file_disable(
                 UnitFileChange **changes,
                 unsigned *n_changes) {
 
-        _cleanup_lookup_paths_free_ LookupPaths paths = {};
+        _cleanup_(lookup_paths_free) LookupPaths paths = {};
         _cleanup_(install_context_done) InstallContext c = {};
         _cleanup_set_free_free_ Set *remove_symlinks_to = NULL;
         const char *config_path;
@@ -2578,7 +2578,7 @@ int unit_file_set_default(
                 UnitFileChange **changes,
                 unsigned *n_changes) {
 
-        _cleanup_lookup_paths_free_ LookupPaths paths = {};
+        _cleanup_(lookup_paths_free) LookupPaths paths = {};
         _cleanup_(install_context_done) InstallContext c = {};
         UnitFileInstallInfo *i;
         const char *new_path;
@@ -2613,7 +2613,7 @@ int unit_file_get_default(
                 const char *root_dir,
                 char **name) {
 
-        _cleanup_lookup_paths_free_ LookupPaths paths = {};
+        _cleanup_(lookup_paths_free) LookupPaths paths = {};
         _cleanup_(install_context_done) InstallContext c = {};
         UnitFileInstallInfo *i;
         char *n;
@@ -2737,7 +2737,7 @@ int unit_file_get_state(
                 const char *name,
                 UnitFileState *ret) {
 
-        _cleanup_lookup_paths_free_ LookupPaths paths = {};
+        _cleanup_(lookup_paths_free) LookupPaths paths = {};
         int r;
 
         assert(scope >= 0);
@@ -3020,7 +3020,7 @@ int unit_file_preset(
                 unsigned *n_changes) {
 
         _cleanup_(install_context_done) InstallContext plus = {}, minus = {};
-        _cleanup_lookup_paths_free_ LookupPaths paths = {};
+        _cleanup_(lookup_paths_free) LookupPaths paths = {};
         _cleanup_(presets_freep) Presets presets = {};
         const char *config_path;
         char **i;
@@ -3060,7 +3060,7 @@ int unit_file_preset_all(
                 unsigned *n_changes) {
 
         _cleanup_(install_context_done) InstallContext plus = {}, minus = {};
-        _cleanup_lookup_paths_free_ LookupPaths paths = {};
+        _cleanup_(lookup_paths_free) LookupPaths paths = {};
         _cleanup_(presets_freep) Presets presets = {};
         const char *config_path = NULL;
         char **i;
@@ -3143,7 +3143,7 @@ int unit_file_get_list(
                 char **states,
                 char **patterns) {
 
-        _cleanup_lookup_paths_free_ LookupPaths paths = {};
+        _cleanup_(lookup_paths_free) LookupPaths paths = {};
         char **i;
         int r;
 
index 259b36503cd0f07b4249d2dc70e93acf1b8281bf..440b1f574f44a245adfae1c144edba26c76c2f78 100644 (file)
@@ -440,7 +440,7 @@ int image_discover(Hashmap *h) {
 }
 
 int image_remove(Image *i) {
-        _cleanup_release_lock_file_ LockFile global_lock = LOCK_FILE_INIT, local_lock = LOCK_FILE_INIT;
+        _cleanup_(release_lock_file) LockFile global_lock = LOCK_FILE_INIT, local_lock = LOCK_FILE_INIT;
         _cleanup_strv_free_ char **settings = NULL;
         _cleanup_free_ char *roothash = NULL;
         char **j;
@@ -531,7 +531,7 @@ static int rename_auxiliary_file(const char *path, const char *new_name, const c
 }
 
 int image_rename(Image *i, const char *new_name) {
-        _cleanup_release_lock_file_ LockFile global_lock = LOCK_FILE_INIT, local_lock = LOCK_FILE_INIT, name_lock = LOCK_FILE_INIT;
+        _cleanup_(release_lock_file) LockFile global_lock = LOCK_FILE_INIT, local_lock = LOCK_FILE_INIT, name_lock = LOCK_FILE_INIT;
         _cleanup_free_ char *new_path = NULL, *nn = NULL, *roothash = NULL;
         _cleanup_strv_free_ char **settings = NULL;
         unsigned file_attr = 0;
@@ -652,7 +652,7 @@ static int clone_auxiliary_file(const char *path, const char *new_name, const ch
 }
 
 int image_clone(Image *i, const char *new_name, bool read_only) {
-        _cleanup_release_lock_file_ LockFile name_lock = LOCK_FILE_INIT;
+        _cleanup_(release_lock_file) LockFile name_lock = LOCK_FILE_INIT;
         _cleanup_strv_free_ char **settings = NULL;
         _cleanup_free_ char *roothash = NULL;
         const char *new_path;
@@ -735,7 +735,7 @@ int image_clone(Image *i, const char *new_name, bool read_only) {
 }
 
 int image_read_only(Image *i, bool b) {
-        _cleanup_release_lock_file_ LockFile global_lock = LOCK_FILE_INIT, local_lock = LOCK_FILE_INIT;
+        _cleanup_(release_lock_file) LockFile global_lock = LOCK_FILE_INIT, local_lock = LOCK_FILE_INIT;
         int r;
 
         assert(i);
@@ -906,7 +906,7 @@ int image_set_limit(Image *i, uint64_t referenced_max) {
 }
 
 int image_read_metadata(Image *i) {
-        _cleanup_release_lock_file_ LockFile global_lock = LOCK_FILE_INIT, local_lock = LOCK_FILE_INIT;
+        _cleanup_(release_lock_file) LockFile global_lock = LOCK_FILE_INIT, local_lock = LOCK_FILE_INIT;
         int r;
 
         assert(i);
index e4713b9f4e01df5d1903d81653a5a3d358310807..f2b0bb76a126c260b3d74f2c93a5d1bd8d6bb1c4 100644 (file)
@@ -158,7 +158,7 @@ fail:
 }
 
 int setup_machine_directory(uint64_t size, sd_bus_error *error) {
-        _cleanup_release_lock_file_ LockFile lock_file = LOCK_FILE_INIT;
+        _cleanup_(release_lock_file) LockFile lock_file = LOCK_FILE_INIT;
         struct loop_info64 info = {
                 .lo_flags = LO_FLAGS_AUTOCLEAR,
         };
index 183d204799bf895b60eb157bacdab34e099c2aa8..f5bba63f5b0b328df8a5910701b347973eb10f1c 100644 (file)
@@ -69,6 +69,5 @@ void lookup_paths_trim_generator(LookupPaths *p);
 void lookup_paths_flush_generator(LookupPaths *p);
 
 void lookup_paths_free(LookupPaths *p);
-#define _cleanup_lookup_paths_free_ _cleanup_(lookup_paths_free)
 
 char **generator_binary_paths(UnitFileScope scope);
index 527f93f97f97ef6d74ee5287f285aa9f0ed722ab..0f270f7fbd03f53b5b6cd182cff57baffc1a195b 100644 (file)
@@ -20,15 +20,4 @@ DEFINE_TRIVIAL_CLEANUP_FUNC(struct udev_ctrl_connection*, udev_ctrl_connection_u
 DEFINE_TRIVIAL_CLEANUP_FUNC(struct udev_ctrl_msg*, udev_ctrl_msg_unref);
 DEFINE_TRIVIAL_CLEANUP_FUNC(struct udev_monitor*, udev_monitor_unref);
 
-#define _cleanup_udev_unref_ _cleanup_(udev_unrefp)
-#define _cleanup_udev_device_unref_ _cleanup_(udev_device_unrefp)
-#define _cleanup_udev_enumerate_unref_ _cleanup_(udev_enumerate_unrefp)
-#define _cleanup_udev_event_unref_ _cleanup_(udev_event_unrefp)
-#define _cleanup_udev_rules_unref_ _cleanup_(udev_rules_unrefp)
-#define _cleanup_udev_ctrl_unref_ _cleanup_(udev_ctrl_unrefp)
-#define _cleanup_udev_ctrl_connection_unref_ _cleanup_(udev_ctrl_connection_unrefp)
-#define _cleanup_udev_ctrl_msg_unref_ _cleanup_(udev_ctrl_msg_unrefp)
-#define _cleanup_udev_monitor_unref_ _cleanup_(udev_monitor_unrefp)
-#define _cleanup_udev_list_cleanup_ _cleanup_(udev_list_cleanup)
-
 int udev_parse_config(void);
index bcf5babb42eff69f3128ef97f6f71e78e15d878d..69a6d940ef29e2fcd68ae0471fa3445d8868d121 100644 (file)
@@ -5338,7 +5338,7 @@ static int cat_file(const char *filename, bool newline) {
 }
 
 static int cat(int argc, char *argv[], void *userdata) {
-        _cleanup_lookup_paths_free_ LookupPaths lp = {};
+        _cleanup_(lookup_paths_free) LookupPaths lp = {};
         _cleanup_strv_free_ char **names = NULL;
         char **name;
         sd_bus *bus;
@@ -5865,7 +5865,7 @@ static int enable_sysv_units(const char *verb, char **args) {
         int r = 0;
 
 #if HAVE_SYSV_COMPAT
-        _cleanup_lookup_paths_free_ LookupPaths paths = {};
+        _cleanup_(lookup_paths_free) LookupPaths paths = {};
         unsigned f = 0;
 
         /* Processes all SysV units, and reshuffles the array so that afterwards only the native units remain */
@@ -6189,7 +6189,7 @@ static int enable_unit(int argc, char *argv[], void *userdata) {
 
                 if (STR_IN_SET(verb, "mask", "unmask")) {
                         char **name;
-                        _cleanup_lookup_paths_free_ LookupPaths lp = {};
+                        _cleanup_(lookup_paths_free) LookupPaths lp = {};
 
                         r = lookup_paths_init(&lp, arg_scope, 0, arg_root);
                         if (r < 0)
@@ -6871,7 +6871,7 @@ static int run_editor(char **paths) {
 }
 
 static int find_paths_to_edit(sd_bus *bus, char **names, char ***paths) {
-        _cleanup_lookup_paths_free_ LookupPaths lp = {};
+        _cleanup_(lookup_paths_free) LookupPaths lp = {};
         char **name;
         int r;
 
index 06dabce210e5b867ddff12b6e60acfae2234c18f..24b1c4e08392bc2c6d544ad05435bb7a77f41697 100644 (file)
@@ -922,7 +922,7 @@ finish:
 
 int main(int argc, char *argv[]) {
         _cleanup_(free_sysvstub_hashmapp) Hashmap *all_services = NULL;
-        _cleanup_lookup_paths_free_ LookupPaths lp = {};
+        _cleanup_(lookup_paths_free) LookupPaths lp = {};
         SysvStub *service;
         Iterator j;
         int r;
index 599219e326a9459af86261674b19a0920fb022f1..e973b52d92abdfe830962196040c158114f5f289 100644 (file)
@@ -91,7 +91,7 @@ static void print_device(struct udev_device *device) {
 }
 
 static void test_device(struct udev *udev, const char *syspath) {
-        _cleanup_udev_device_unref_ struct udev_device *device;
+        _cleanup_(udev_device_unrefp) struct udev_device *device;
 
         log_info("looking at device: %s", syspath);
         device = udev_device_new_from_syspath(udev, syspath);
@@ -102,7 +102,7 @@ static void test_device(struct udev *udev, const char *syspath) {
 }
 
 static void test_device_parents(struct udev *udev, const char *syspath) {
-        _cleanup_udev_device_unref_ struct udev_device *device;
+        _cleanup_(udev_device_unrefp) struct udev_device *device;
         struct udev_device *device_parent;
 
         log_info("looking at device: %s", syspath);
@@ -127,7 +127,7 @@ static void test_device_parents(struct udev *udev, const char *syspath) {
 
 static void test_device_devnum(struct udev *udev) {
         dev_t devnum = makedev(1, 3);
-        _cleanup_udev_device_unref_ struct udev_device *device;
+        _cleanup_(udev_device_unrefp) struct udev_device *device;
 
         log_info("looking up device: %u:%u", major(devnum), minor(devnum));
         device = udev_device_new_from_devnum(udev, 'c', devnum);
@@ -138,7 +138,7 @@ static void test_device_devnum(struct udev *udev) {
 }
 
 static void test_device_subsys_name(struct udev *udev, const char *subsys, const char *dev) {
-        _cleanup_udev_device_unref_ struct udev_device *device;
+        _cleanup_(udev_device_unrefp) struct udev_device *device;
 
         log_info("looking up device: '%s:%s'", subsys, dev);
         device = udev_device_new_from_subsystem_sysname(udev, subsys, dev);
@@ -170,7 +170,7 @@ static int test_enumerate_print_list(struct udev_enumerate *enumerate) {
 }
 
 static void test_monitor(struct udev *udev) {
-        _cleanup_udev_monitor_unref_ struct udev_monitor *udev_monitor;
+        _cleanup_(udev_monitor_unrefp) struct udev_monitor *udev_monitor;
         _cleanup_close_ int fd_ep;
         int fd_udev;
         struct epoll_event ep_udev = {
@@ -337,7 +337,7 @@ static void test_hwdb(struct udev *udev, const char *modalias) {
 }
 
 int main(int argc, char *argv[]) {
-        _cleanup_udev_unref_ struct udev *udev = NULL;
+        _cleanup_(udev_unrefp) struct udev *udev = NULL;
         bool arg_monitor = false;
         static const struct option options[] = {
                 { "syspath",   required_argument, NULL, 'p' },
index c66d54bdc30dfedea93f6400abe7ca77d90eb9e4..106062873d01a9463c5d2eab44183387972abfb8 100644 (file)
@@ -17,8 +17,8 @@
 static void test_paths(UnitFileScope scope) {
         char template[] = "/tmp/test-path-lookup.XXXXXXX";
 
-        _cleanup_lookup_paths_free_ LookupPaths lp_without_env = {};
-        _cleanup_lookup_paths_free_ LookupPaths lp_with_env = {};
+        _cleanup_(lookup_paths_free) LookupPaths lp_without_env = {};
+        _cleanup_(lookup_paths_free) LookupPaths lp_with_env = {};
         char *systemd_unit_path;
 
         assert_se(mkdtemp(template));
@@ -40,7 +40,7 @@ static void test_paths(UnitFileScope scope) {
 }
 
 static void test_user_and_global_paths(void) {
-        _cleanup_lookup_paths_free_ LookupPaths lp_global = {}, lp_user = {};
+        _cleanup_(lookup_paths_free) LookupPaths lp_global = {}, lp_user = {};
         char **u, **g, **p;
         unsigned k = 0;
 
index ee5bc43bc8064c33230dddd293036c36e5cb3c5d..c79384847da9bef1baa5104aabdae58b2a189e8b 100644 (file)
@@ -56,10 +56,10 @@ static int fake_filesystems(void) {
 }
 
 int main(int argc, char *argv[]) {
-        _cleanup_udev_unref_ struct udev *udev = NULL;
-        _cleanup_udev_event_unref_ struct udev_event *event = NULL;
-        _cleanup_udev_device_unref_ struct udev_device *dev = NULL;
-        _cleanup_udev_rules_unref_ struct udev_rules *rules = NULL;
+        _cleanup_(udev_unrefp) struct udev *udev = NULL;
+        _cleanup_(udev_event_unrefp) struct udev_event *event = NULL;
+        _cleanup_(udev_device_unrefp) struct udev_device *dev = NULL;
+        _cleanup_(udev_rules_unrefp) struct udev_rules *rules = NULL;
         char syspath[UTIL_PATH_SIZE];
         const char *devpath;
         const char *action;
index 7e3654c30fa9c9757cdab9bd07eabf171e65b44f..2cdb0acd9a8c7df584a2163394cb56f275015344 100644 (file)
@@ -405,9 +405,8 @@ out:
         return ret;
 }
 
-int main(int argc, char *argv[])
-{
-        _cleanup_udev_unref_ struct udev *udev = NULL;
+int main(int argc, char *argv[]) {
+        _cleanup_(udev_unrefp) struct udev *udev = NULL;
         struct hd_driveid id;
         union {
                 uint8_t  byte[512];
index 63d275603900f3fa95041e666e399849a6754ffe..217fb2f8abe3207604f34f2fe7c8941adc3793f7 100644 (file)
@@ -569,9 +569,8 @@ out:
         return retval;
 }
 
-int main(int argc, char **argv)
-{
-        _cleanup_udev_unref_ struct udev *udev;
+int main(int argc, char **argv) {
+        _cleanup_(udev_unrefp) struct udev *udev;
         int retval = 0;
         char maj_min_dev[MAX_PATH_LEN];
         int newargc;
index eeed803f57262b038a42f9b843ee68cdbc3b3d5f..279ce9da5650b577478394d29364804d39da426f 100644 (file)
@@ -228,7 +228,7 @@ static int builtin_blkid(struct udev_device *dev, int argc, char *argv[], bool t
         int64_t offset = 0;
         bool noraid = false;
         _cleanup_close_ int fd = -1;
-        _cleanup_blkid_free_probe_ blkid_probe pr = NULL;
+        _cleanup_(blkid_free_probep) blkid_probe pr = NULL;
         const char *data;
         const char *name;
         int nvals;
index 6d7bf1674e0bad57a53cf8879ba26447470194bb..d8c58ea277568fea5a813506e73ac883b6ed6206 100644 (file)
@@ -126,7 +126,7 @@ static int builtin_hwdb(struct udev_device *dev, int argc, char *argv[], bool te
         const char *device = NULL;
         const char *subsystem = NULL;
         const char *prefix = NULL;
-        _cleanup_udev_device_unref_ struct udev_device *srcdev = NULL;
+        _cleanup_(udev_device_unrefp) struct udev_device *srcdev = NULL;
 
         if (!hwdb)
                 return EXIT_FAILURE;
index dc97ea6b082aa4c0527e390f155b0a8875a83f22..ca644e37f50653aee712d7cad30257db01c9eccc 100644 (file)
@@ -296,7 +296,7 @@ static int dev_pci_slot(struct udev_device *dev, struct netnames *names) {
         size_t l;
         char *s;
         const char *attr, *port_name;
-        _cleanup_udev_device_unref_ struct udev_device *pci = NULL;
+        _cleanup_(udev_device_unrefp) struct udev_device *pci = NULL;
         struct udev_device *hotplug_slot_dev;
         char slots[PATH_MAX];
         _cleanup_closedir_ DIR *dir = NULL;
index 7d967e04dee7ed9a4ff044b19c38e6b0aec8f313..51748dcae8efc76ffa5a2d1e53972b687dbcecd6 100644 (file)
@@ -104,7 +104,7 @@ static struct udev_device *skip_subsystem(struct udev_device *dev, const char *s
 static struct udev_device *handle_scsi_fibre_channel(struct udev_device *parent, char **path) {
         struct udev *udev;
         struct udev_device *targetdev;
-        _cleanup_udev_device_unref_ struct udev_device *fcdev = NULL;
+        _cleanup_(udev_device_unrefp) struct udev_device *fcdev = NULL;
         const char *port;
         _cleanup_free_ char *lun = NULL;
 
@@ -133,7 +133,7 @@ static struct udev_device *handle_scsi_fibre_channel(struct udev_device *parent,
 static struct udev_device *handle_scsi_sas_wide_port(struct udev_device *parent, char **path) {
         struct udev *udev;
         struct udev_device *targetdev, *target_parent;
-        _cleanup_udev_device_unref_ struct udev_device *sasdev = NULL;
+        _cleanup_(udev_device_unrefp) struct udev_device *sasdev = NULL;
         const char *sas_address;
         _cleanup_free_ char *lun = NULL;
 
@@ -168,7 +168,7 @@ static struct udev_device *handle_scsi_sas(struct udev_device *parent, char **pa
 {
         struct udev *udev;
         struct udev_device *targetdev, *target_parent, *port, *expander;
-        _cleanup_udev_device_unref_ struct udev_device
+        _cleanup_(udev_device_unrefp) struct udev_device
                 *target_sasdev = NULL, *expander_sasdev = NULL, *port_sasdev = NULL;
         const char *sas_address = NULL;
         const char *phy_id;
@@ -244,7 +244,7 @@ static struct udev_device *handle_scsi_sas(struct udev_device *parent, char **pa
 static struct udev_device *handle_scsi_iscsi(struct udev_device *parent, char **path) {
         struct udev *udev;
         struct udev_device *transportdev;
-        _cleanup_udev_device_unref_ struct udev_device
+        _cleanup_(udev_device_unrefp) struct udev_device
                 *sessiondev = NULL, *conndev = NULL;
         const char *target, *connname, *addr, *port;
         _cleanup_free_ char *lun = NULL;
@@ -291,7 +291,7 @@ static struct udev_device *handle_scsi_iscsi(struct udev_device *parent, char **
 static struct udev_device *handle_scsi_ata(struct udev_device *parent, char **path) {
         struct udev *udev;
         struct udev_device *targetdev, *target_parent;
-        _cleanup_udev_device_unref_ struct udev_device *atadev = NULL;
+        _cleanup_(udev_device_unrefp) struct udev_device *atadev = NULL;
         const char *port_no;
 
         assert(parent);
index c704279512440aa8732e68e6e61c84ab48918190..05df3e81986a9cd038b4c61b2b88ea63eb62e7c5 100644 (file)
@@ -44,7 +44,7 @@ static void print_help(void) {
 }
 
 static int adm_control(struct udev *udev, int argc, char *argv[]) {
-        _cleanup_udev_ctrl_unref_ struct udev_ctrl *uctrl = NULL;
+        _cleanup_(udev_ctrl_unrefp) struct udev_ctrl *uctrl = NULL;
         int timeout = 60;
         int rc = 1, c;
 
index 580e95095b56909f7577188b0ce5a43d180160c8..ab81c0a501405dadf1cd28557d9bbf19aa3e3e21 100644 (file)
@@ -173,7 +173,7 @@ static int stat_device(const char *name, bool export, const char *prefix) {
 }
 
 static int export_devices(struct udev *udev) {
-        _cleanup_udev_enumerate_unref_ struct udev_enumerate *udev_enumerate;
+        _cleanup_(udev_enumerate_unrefp) struct udev_enumerate *udev_enumerate;
         struct udev_list_entry *list_entry;
 
         udev_enumerate = udev_enumerate_new(udev);
@@ -182,7 +182,7 @@ static int export_devices(struct udev *udev) {
 
         udev_enumerate_scan_devices(udev_enumerate);
         udev_list_entry_foreach(list_entry, udev_enumerate_get_list_entry(udev_enumerate)) {
-                _cleanup_udev_device_unref_ struct udev_device *device;
+                _cleanup_(udev_device_unrefp) struct udev_device *device;
 
                 device = udev_device_new_from_syspath(udev, udev_list_entry_get_name(list_entry));
                 if (device != NULL)
@@ -272,7 +272,7 @@ static void help(void) {
 }
 
 static int uinfo(struct udev *udev, int argc, char *argv[]) {
-        _cleanup_udev_device_unref_ struct udev_device *device = NULL;
+        _cleanup_(udev_device_unrefp) struct udev_device *device = NULL;
         bool root = 0;
         bool export = 0;
         const char *export_prefix = NULL;
index 028ef92bc2e79ccb355fde21d1e5cc6db9d55141..8984039da9119914071633a7e85ba102dcb5d715 100644 (file)
@@ -79,10 +79,10 @@ static int adm_monitor(struct udev *udev, int argc, char *argv[]) {
         bool prop = false;
         bool print_kernel = false;
         bool print_udev = false;
-        _cleanup_udev_list_cleanup_ struct udev_list subsystem_match_list;
-        _cleanup_udev_list_cleanup_ struct udev_list tag_match_list;
-        _cleanup_udev_monitor_unref_ struct udev_monitor *udev_monitor = NULL;
-        _cleanup_udev_monitor_unref_ struct udev_monitor *kernel_monitor = NULL;
+        _cleanup_(udev_list_cleanup) struct udev_list subsystem_match_list;
+        _cleanup_(udev_list_cleanup) struct udev_list tag_match_list;
+        _cleanup_(udev_monitor_unrefp) struct udev_monitor *udev_monitor = NULL;
+        _cleanup_(udev_monitor_unrefp) struct udev_monitor *kernel_monitor = NULL;
         _cleanup_close_ int fd_ep = -1;
         int fd_kernel = -1, fd_udev = -1;
         struct epoll_event ep_kernel, ep_udev;
index ef1f2f0269a257269a6c5c6d057ca5e374e8913d..cca49b2cccca3ff94f80c80933f14f773ba65386 100644 (file)
@@ -48,9 +48,9 @@ static int adm_test(struct udev *udev, int argc, char *argv[]) {
         const char *action = "add";
         const char *syspath = NULL;
         struct udev_list_entry *entry;
-        _cleanup_udev_rules_unref_ struct udev_rules *rules = NULL;
-        _cleanup_udev_device_unref_ struct udev_device *dev = NULL;
-        _cleanup_udev_event_unref_ struct udev_event *event = NULL;
+        _cleanup_(udev_rules_unrefp) struct udev_rules *rules = NULL;
+        _cleanup_(udev_device_unrefp) struct udev_device *dev = NULL;
+        _cleanup_(udev_event_unrefp) struct udev_event *event = NULL;
         sigset_t mask, sigmask_orig;
         int rc = 0, c;
 
index d979c1bc249af1d11b14b458455001ecfcd9b745..d463b838997b69ee22882c18c6c101b1e8febd78 100644 (file)
@@ -134,8 +134,8 @@ static int adm_trigger(struct udev *udev, int argc, char *argv[]) {
                 TYPE_SUBSYSTEMS,
         } device_type = TYPE_DEVICES;
         const char *action = "change";
-        _cleanup_udev_enumerate_unref_ struct udev_enumerate *udev_enumerate = NULL;
-        _cleanup_udev_monitor_unref_ struct udev_monitor *udev_monitor = NULL;
+        _cleanup_(udev_enumerate_unrefp) struct udev_enumerate *udev_enumerate = NULL;
+        _cleanup_(udev_monitor_unrefp) struct udev_monitor *udev_monitor = NULL;
         _cleanup_close_ int fd_ep = -1;
         int fd_udev = -1;
         struct epoll_event ep_udev;
@@ -230,7 +230,7 @@ static int adm_trigger(struct udev *udev, int argc, char *argv[]) {
                         }
                         break;
                 case 'b': {
-                        _cleanup_udev_device_unref_ struct udev_device *dev;
+                        _cleanup_(udev_device_unrefp) struct udev_device *dev;
 
                         dev = find_device(udev, optarg, "/sys");
                         if (!dev) {
@@ -250,7 +250,7 @@ static int adm_trigger(struct udev *udev, int argc, char *argv[]) {
                         break;
 
                 case ARG_NAME: {
-                        _cleanup_udev_device_unref_ struct udev_device *dev;
+                        _cleanup_(udev_device_unrefp) struct udev_device *dev;
 
                         dev = find_device(udev, optarg, "/dev/");
                         if (!dev) {
@@ -280,7 +280,7 @@ static int adm_trigger(struct udev *udev, int argc, char *argv[]) {
         }
 
         for (; optind < argc; optind++) {
-                _cleanup_udev_device_unref_ struct udev_device *dev;
+                _cleanup_(udev_device_unrefp) struct udev_device *dev;
 
                 dev = find_device(udev, argv[optind], NULL);
                 if (!dev) {
@@ -355,7 +355,7 @@ static int adm_trigger(struct udev *udev, int argc, char *argv[]) {
 
                 for (i = 0; i < fdcount; i++) {
                         if (ev[i].data.fd == fd_udev && ev[i].events & EPOLLIN) {
-                                _cleanup_udev_device_unref_ struct udev_device *device;
+                                _cleanup_(udev_device_unrefp) struct udev_device *device;
                                 const char *syspath = NULL;
 
                                 device = udev_monitor_receive_device(udev_monitor);
index c30e98dd985b7819a91131cd2b0ca88d455f32aa..0e75010db286aa353e8ed458010f7404fcb50254 100644 (file)
@@ -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();