]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
tree-wide: use _cleanup_set_free_ and friends
authorYu Watanabe <watanabe.yu+github@gmail.com>
Sun, 28 May 2023 13:33:44 +0000 (22:33 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 31 May 2023 21:47:48 +0000 (06:47 +0900)
Instead of _cleanup_(set_freep) or so.

52 files changed:
src/analyze/analyze-security.c
src/core/dbus-manager.c
src/core/unit.c
src/creds/creds.c
src/cryptenroll/cryptenroll-wipe.c
src/dissect/dissect.c
src/home/homectl-pkcs11.c
src/home/homectl-recovery-key.c
src/home/homectl.c
src/home/homed-manager-bus.c
src/home/homed-manager.c
src/home/homework-cifs.c
src/home/homework.c
src/home/user-record-util.c
src/libsystemd/sd-device/test-sd-device.c
src/libsystemd/sd-event/test-event.c
src/notify/notify.c
src/partition/repart.c
src/portable/portable.c
src/pstore/pstore.c
src/shared/bootspec.c
src/shared/data-fd-util.c
src/shared/elf-util.c
src/shared/kbd-util.c
src/shared/libfido2-util.c
src/shared/mkfs-util.c
src/shared/sleep-config.c
src/shared/tpm2-util.c
src/shared/userdb.c
src/shutdown/umount.c
src/sysctl/sysctl.c
src/sysext/sysext.c
src/systemctl/systemctl-edit.c
src/systemctl/systemctl-list-unit-files.c
src/sysupdate/sysupdate-resource.c
src/sysupdate/sysupdate-transfer.c
src/sysupdate/sysupdate.c
src/test/test-data-fd-util.c
src/test/test-hashmap-plain.c
src/test/test-install-root.c
src/test/test-install.c
src/test/test-load-fragment.c
src/test/test-loop-block.c
src/test/test-set.c
src/test/test-strv.c
src/test/test-varlink.c
src/tmpfiles/offline-passwd.c
src/tmpfiles/test-offline-passwd.c
src/tmpfiles/tmpfiles.c
src/udev/udevadm-lock.c
src/userdb/userdbctl.c
src/xdg-autostart-generator/xdg-autostart-generator.c

index 56bc3627767bfec3d7c9c3200f25ff877f1a71a0..1fcdbf9cd32513761e1c473f6c44ef1f1f130a93 100644 (file)
@@ -2229,7 +2229,7 @@ static int property_read_ip_filters(
                 void *userdata) {
 
         SecurityInfo *info = userdata;
-        _cleanup_(strv_freep) char **l = NULL;
+        _cleanup_strv_free_ char **l = NULL;
         int r;
 
         assert(bus);
index d6b2dcb11452e5a194ad2494b4ba6aeb6e1c0872..c02ad09c0787f199f96c1ec0e3885e8516269390 100644 (file)
@@ -2153,7 +2153,7 @@ static int list_unit_files_by_patterns(sd_bus_message *message, void *userdata,
         _cleanup_(sd_bus_message_unrefp) sd_bus_message *reply = NULL;
         Manager *m = ASSERT_PTR(userdata);
         UnitFileList *item;
-        _cleanup_(hashmap_freep) Hashmap *h = NULL;
+        _cleanup_hashmap_free_ Hashmap *h = NULL;
         int r;
 
         assert(message);
index 8b4fb0fce4170b6c5a9f61f743dc61881b7b6990..7b6d50e0eaf554628091f25d3db91cfe4bce882c 100644 (file)
@@ -1082,7 +1082,7 @@ static void unit_merge_dependencies(Unit *u, Unit *other) {
         }
 
         for (;;) {
-                _cleanup_(hashmap_freep) Hashmap *other_deps = NULL;
+                _cleanup_hashmap_free_ Hashmap *other_deps = NULL;
                 UnitDependencyInfo di_back;
                 Unit *back;
 
index 670e719d21f36c19a6cee6fd00ffe158a26c89cf..51efe2761686512403a8d5d9206bee54d6888f52 100644 (file)
@@ -122,7 +122,7 @@ not_found:
 }
 
 static int add_credentials_to_table(Table *t, bool encrypted) {
-        _cleanup_(closedirp) DIR *d = NULL;
+        _cleanup_closedir_ DIR *d = NULL;
         const char *prefix;
         int r;
 
@@ -382,7 +382,7 @@ static int verb_cat(int argc, char **argv, void *userdata) {
 
                 /* Look both in regular and in encrypted credentials */
                 for (encrypted = 0; encrypted < 2; encrypted++) {
-                        _cleanup_(closedirp) DIR *d = NULL;
+                        _cleanup_closedir_ DIR *d = NULL;
 
                         r = open_credential_directory(encrypted, &d, NULL);
                         if (r < 0)
index 8042a0fe835883808368d9ab4e42562b11b55337..314ebd3113b703c8de0c523b9401fb0fcd908a86 100644 (file)
@@ -88,7 +88,7 @@ static int find_slots_by_mask(
                 Set *keep_slots,
                 unsigned by_mask) {
 
-        _cleanup_(set_freep) Set *listed_slots = NULL;
+        _cleanup_set_free_ Set *listed_slots = NULL;
         int r;
 
         assert(cd);
@@ -301,7 +301,7 @@ int wipe_slots(struct crypt_device *cd,
                unsigned by_mask,
                int except_slot) {
 
-        _cleanup_(set_freep) Set *wipe_slots = NULL, *wipe_tokens = NULL, *keep_slots = NULL;
+        _cleanup_set_free_ Set *wipe_slots = NULL, *wipe_tokens = NULL, *keep_slots = NULL;
         _cleanup_free_ int *ordered_slots = NULL, *ordered_tokens = NULL;
         size_t n_ordered_slots = 0, n_ordered_tokens = 0;
         int r, slot_max, ret;
index 45e0abc63d81cb85c6712619452ea030ce2b3916..5c742497d5cae6a7eea21b98e280b34ab01c7b67 100644 (file)
@@ -1569,7 +1569,7 @@ static int action_with(DissectedImage *m, LoopDevice *d) {
 }
 
 static int action_discover(void) {
-        _cleanup_(hashmap_freep) Hashmap *images = NULL;
+        _cleanup_hashmap_free_ Hashmap *images = NULL;
         _cleanup_(table_unrefp) Table *t = NULL;
         Image *img;
         int r;
index dc6ecf166562778477506ed76bac43f1bbe37493..2539af063118690de030ca398ad816fbfeb107a9 100644 (file)
@@ -100,7 +100,7 @@ static int add_pkcs11_token_uri(JsonVariant **v, const char *uri) {
 
 int identity_add_token_pin(JsonVariant **v, const char *pin) {
         _cleanup_(json_variant_unrefp) JsonVariant *w = NULL, *l = NULL;
-        _cleanup_(strv_free_erasep) char **pins = NULL;
+        _cleanup_strv_free_erase_ char **pins = NULL;
         int r;
 
         assert(v);
index ff1ab6820db34fc763b73c5abc1b83e4113b2349..bf18ae49e423d63cc09fdddc959a0904e1b67b05 100644 (file)
@@ -67,7 +67,7 @@ static int add_public(JsonVariant **v) {
 
 static int add_secret(JsonVariant **v, const char *password) {
         _cleanup_(json_variant_unrefp) JsonVariant *w = NULL, *l = NULL;
-        _cleanup_(strv_free_erasep) char **passwords = NULL;
+        _cleanup_strv_free_erase_ char **passwords = NULL;
         int r;
 
         assert(v);
index b265f8741e2aaa8fac93005bf42af07b4b2295a5..d6e6bd0855cd3ee4941561547287121e362aea43 100644 (file)
@@ -210,7 +210,7 @@ static int acquire_existing_password(
                 bool emphasize_current,
                 AskPasswordFlags flags) {
 
-        _cleanup_(strv_free_erasep) char **password = NULL;
+        _cleanup_strv_free_erase_ char **password = NULL;
         _cleanup_(erase_and_freep) char *envpw = NULL;
         _cleanup_free_ char *question = NULL;
         int r;
@@ -271,7 +271,7 @@ static int acquire_recovery_key(
                 UserRecord *hr,
                 AskPasswordFlags flags) {
 
-        _cleanup_(strv_free_erasep) char **recovery_key = NULL;
+        _cleanup_strv_free_erase_ char **recovery_key = NULL;
         _cleanup_(erase_and_freep) char *envpw = NULL;
         _cleanup_free_ char *question = NULL;
         int r;
@@ -329,7 +329,7 @@ static int acquire_token_pin(
                 UserRecord *hr,
                 AskPasswordFlags flags) {
 
-        _cleanup_(strv_free_erasep) char **pin = NULL;
+        _cleanup_strv_free_erase_ char **pin = NULL;
         _cleanup_(erase_and_freep) char *envpin = NULL;
         _cleanup_free_ char *question = NULL;
         int r;
@@ -699,7 +699,7 @@ static char **mangle_user_list(char **list, char ***ret_allocated) {
 
 static int inspect_home(int argc, char *argv[], void *userdata) {
         _cleanup_(sd_bus_flush_close_unrefp) sd_bus *bus = NULL;
-        _cleanup_(strv_freep) char **mangled_list = NULL;
+        _cleanup_strv_free_ char **mangled_list = NULL;
         int r, ret = 0;
         char **items;
 
@@ -783,7 +783,7 @@ static int inspect_home(int argc, char *argv[], void *userdata) {
 
 static int authenticate_home(int argc, char *argv[], void *userdata) {
         _cleanup_(sd_bus_flush_close_unrefp) sd_bus *bus = NULL;
-        _cleanup_(strv_freep) char **mangled_list = NULL;
+        _cleanup_strv_free_ char **mangled_list = NULL;
         int r, ret = 0;
         char **items;
 
@@ -1187,7 +1187,7 @@ static int acquire_new_password(
                 (void) suggest_passwords();
 
         for (;;) {
-                _cleanup_(strv_free_erasep) char **first = NULL, **second = NULL;
+                _cleanup_strv_free_erase_ char **first = NULL, **second = NULL;
                 _cleanup_free_ char *question = NULL;
 
                 if (--i == 0)
@@ -3162,7 +3162,7 @@ static int parse_argv(int argc, char *argv[]) {
 
                 case ARG_SSH_AUTHORIZED_KEYS: {
                         _cleanup_(json_variant_unrefp) JsonVariant *v = NULL;
-                        _cleanup_(strv_freep) char **l = NULL, **add = NULL;
+                        _cleanup_strv_free_ char **l = NULL, **add = NULL;
 
                         if (isempty(optarg)) {
                                 r = drop_from_identity("sshAuthorizedKeys");
index ca639ae39e87341965ff6ff11d7b57477c7b0d0c..7cf543922f9ae299c580628791de5833a7ba9c4d 100644 (file)
@@ -36,7 +36,7 @@ static int property_get_auto_login(
                 return r;
 
         HASHMAP_FOREACH(h, m->homes_by_name) {
-                _cleanup_(strv_freep) char **seats = NULL;
+                _cleanup_strv_free_ char **seats = NULL;
                 _cleanup_free_ char *home_path = NULL;
 
                 r = home_auto_login(h, &seats);
index 92fe5a88b8211fa79ff9d741b09130d1a510ea7c..9db8b9ee068e4d0b377c7c8a83b36f66de3ab11d 100644 (file)
@@ -1357,7 +1357,7 @@ static int manager_enumerate_devices(Manager *m) {
 }
 
 static int manager_load_key_pair(Manager *m) {
-        _cleanup_(fclosep) FILE *f = NULL;
+        _cleanup_fclose_ FILE *f = NULL;
         struct stat st;
         int r;
 
index 8ad1da6303d55acab38479c390b49223d81cacfa..dff99e5a86a72b74ec9241fa1e4d1e3b39404722 100644 (file)
@@ -60,7 +60,7 @@ int home_setup_cifs(
         STRV_FOREACH(pw, h->password) {
                 _cleanup_(unlink_and_freep) char *p = NULL;
                 _cleanup_free_ char *options = NULL;
-                _cleanup_(fclosep) FILE *f = NULL;
+                _cleanup_fclose_ FILE *f = NULL;
                 pid_t mount_pid;
                 int exit_status;
 
index 28907386a46419fe4b49f1a89aa87219c6ce28c5..f8e333bb979030bd00137959522a7169a9b454c6 100644 (file)
@@ -511,7 +511,7 @@ int home_sync_and_statfs(int root_fd, struct statfs *ret) {
 }
 
 static int read_identity_file(int root_fd, JsonVariant **ret) {
-        _cleanup_(fclosep) FILE *identity_file = NULL;
+        _cleanup_fclose_ FILE *identity_file = NULL;
         _cleanup_close_ int identity_fd = -EBADF;
         unsigned line, column;
         int r;
@@ -542,7 +542,7 @@ static int read_identity_file(int root_fd, JsonVariant **ret) {
 
 static int write_identity_file(int root_fd, JsonVariant *v, uid_t uid) {
         _cleanup_(json_variant_unrefp) JsonVariant *normalized = NULL;
-        _cleanup_(fclosep) FILE *identity_file = NULL;
+        _cleanup_fclose_ FILE *identity_file = NULL;
         _cleanup_close_ int identity_fd = -EBADF;
         _cleanup_free_ char *fn = NULL;
         int r;
@@ -1088,7 +1088,7 @@ static int user_record_compile_effective_passwords(
                 PasswordCache *cache,
                 char ***ret_effective_passwords) {
 
-        _cleanup_(strv_free_erasep) char **effective = NULL;
+        _cleanup_strv_free_erase_ char **effective = NULL;
         size_t n;
         int r;
 
@@ -1307,7 +1307,7 @@ static int determine_default_storage(UserStorage *ret) {
 }
 
 static int home_create(UserRecord *h, UserRecord **ret_home) {
-        _cleanup_(strv_free_erasep) char **effective_passwords = NULL;
+        _cleanup_strv_free_erase_ char **effective_passwords = NULL;
         _cleanup_(home_setup_done) HomeSetup setup = HOME_SETUP_INIT;
         _cleanup_(user_record_unrefp) UserRecord *new_home = NULL;
         _cleanup_(password_cache_free) PasswordCache cache = {};
@@ -1679,7 +1679,7 @@ static int home_resize(UserRecord *h, bool automatic, UserRecord **ret) {
 
 static int home_passwd(UserRecord *h, UserRecord **ret_home) {
         _cleanup_(user_record_unrefp) UserRecord *header_home = NULL, *embedded_home = NULL, *new_home = NULL;
-        _cleanup_(strv_free_erasep) char **effective_passwords = NULL;
+        _cleanup_strv_free_erase_ char **effective_passwords = NULL;
         _cleanup_(home_setup_done) HomeSetup setup = HOME_SETUP_INIT;
         _cleanup_(password_cache_free) PasswordCache cache = {};
         HomeSetupFlags flags = 0;
@@ -1850,7 +1850,7 @@ static int home_unlock(UserRecord *h) {
 static int run(int argc, char *argv[]) {
         _cleanup_(user_record_unrefp) UserRecord *home = NULL, *new_home = NULL;
         _cleanup_(json_variant_unrefp) JsonVariant *v = NULL;
-        _cleanup_(fclosep) FILE *opened_file = NULL;
+        _cleanup_fclose_ FILE *opened_file = NULL;
         unsigned line = 0, column = 0;
         const char *json_path = NULL;
         FILE *json_file;
index 08f1764d1182534815a48d329cdb6310e1f3063e..58f8ecc6f043752d89cf5bd7bd1a87f68de88a3e 100644 (file)
@@ -871,7 +871,7 @@ int user_record_set_hashed_password(UserRecord *h, char **hashed_password) {
 
 int user_record_set_password(UserRecord *h, char **password, bool prepend) {
         _cleanup_(json_variant_unrefp) JsonVariant *w = NULL;
-        _cleanup_(strv_free_erasep) char **e = NULL;
+        _cleanup_strv_free_erase_ char **e = NULL;
         int r;
 
         assert(h);
@@ -933,7 +933,7 @@ int user_record_set_password(UserRecord *h, char **password, bool prepend) {
 
 int user_record_set_token_pin(UserRecord *h, char **pin, bool prepend) {
         _cleanup_(json_variant_unrefp) JsonVariant *w = NULL;
-        _cleanup_(strv_free_erasep) char **e = NULL;
+        _cleanup_strv_free_erase_ char **e = NULL;
         int r;
 
         assert(h);
index 8c6d59e0409d3d231b6f2a90a22e13beb2c37273..fb3ae9f329cb4a39d9b309b37121f7779e7a0eac 100644 (file)
@@ -266,7 +266,7 @@ static void test_sd_device_enumerator_filter_subsystem_one(
 
 static bool test_sd_device_enumerator_filter_subsystem_trial(void) {
         _cleanup_(sd_device_enumerator_unrefp) sd_device_enumerator *e = NULL;
-        _cleanup_(hashmap_freep) Hashmap *subsystems = NULL;
+        _cleanup_hashmap_free_ Hashmap *subsystems = NULL;
         unsigned n_new_dev = 0, n_removed_dev = 0;
         sd_device *d;
         Hashmap *h;
index c5497e51487005a717c5b8d29060441950c7fe64..fe0d83116db998237e1a1bfbc6c5f724e2472280 100644 (file)
@@ -841,7 +841,7 @@ TEST(leave_ratelimit) {
         bool expect_ratelimit = false, manually_left_ratelimit = false;
         _cleanup_(sd_event_source_unrefp) sd_event_source *s = NULL;
         _cleanup_(sd_event_unrefp) sd_event *e = NULL;
-        _cleanup_(close_pairp) int pfd[2] = PIPE_EBADF;
+        _cleanup_close_pair_ int pfd[2] = PIPE_EBADF;
         unsigned c = 0;
         int r;
 
index c15df588ef2c58b4feb310edeea252ae91de6dcc..f30790bc70b0f95d5d560386974315b61b653cac 100644 (file)
@@ -132,7 +132,7 @@ static int parse_argv(int argc, char *argv[]) {
                 {}
         };
 
-        _cleanup_(fdset_freep) FDSet *passed = NULL;
+        _cleanup_fdset_free_ FDSet *passed = NULL;
         bool do_exec = false;
         int c, r, n_env;
 
index 2e9badfd31b3e5ef33d5943438f6087ab02ccaee..89f7211bfd57ca20d967f6e47a3acee6d5b3d99d 100644 (file)
@@ -5261,7 +5261,7 @@ static int resolve_copy_blocks_auto(
 
         const char *try1 = NULL, *try2 = NULL;
         char p[SYS_BLOCK_PATH_MAX("/slaves")];
-        _cleanup_(closedirp) DIR *d = NULL;
+        _cleanup_closedir_ DIR *d = NULL;
         sd_id128_t found_uuid = SD_ID128_NULL;
         dev_t devno, found = 0;
         int r;
index 7ab3ac6e97525bff924a2c23a853783f0a6169d8..1c31377567812812fb1026938fe306653ad64b2b 100644 (file)
@@ -357,7 +357,7 @@ static int portable_extract_by_path(
         else {
                 _cleanup_(dissected_image_unrefp) DissectedImage *m = NULL;
                 _cleanup_(rmdir_and_freep) char *tmpdir = NULL;
-                _cleanup_(close_pairp) int seq[2] = PIPE_EBADF;
+                _cleanup_close_pair_ int seq[2] = PIPE_EBADF;
                 _cleanup_(sigkill_waitp) pid_t child = 0;
 
                 /* We now have a loopback block device, let's fork off a child in its own mount namespace, mount it
@@ -689,7 +689,7 @@ int portable_extract(
         _cleanup_(portable_metadata_unrefp) PortableMetadata *os_release = NULL;
         _cleanup_ordered_hashmap_free_ OrderedHashmap *extension_images = NULL, *extension_releases = NULL;
         _cleanup_hashmap_free_ Hashmap *unit_files = NULL;
-        _cleanup_(strv_freep) char **valid_prefixes = NULL;
+        _cleanup_strv_free_ char **valid_prefixes = NULL;
         _cleanup_(image_unrefp) Image *image = NULL;
         int r;
 
index 0a1bf00366c30391e15f436a7900e0f81b074a9d..4501b38cff8f961a5148557eb1d0dd3b5735074b 100644 (file)
@@ -281,7 +281,7 @@ static int process_dmesg_files(PStoreList *list) {
 }
 
 static int list_files(PStoreList *list, const char *sourcepath) {
-        _cleanup_(closedirp) DIR *dirp = NULL;
+        _cleanup_closedir_ DIR *dirp = NULL;
         int r;
 
         dirp = opendir(sourcepath);
index a5ae2478fe85fd853abc6a3bd7b8ee60cf741823..6459f5d2f870aeb565c56f667c11042ac9bdb0e8 100644 (file)
@@ -854,7 +854,7 @@ static int boot_entries_find_unified(
                 const char *root,
                 const char *dir) {
 
-        _cleanup_(closedirp) DIR *d = NULL;
+        _cleanup_closedir_ DIR *d = NULL;
         _cleanup_free_ char *full = NULL;
         int r;
 
index 4831682a020c8319f844f2b6f56ba7d546c4f101..86baf9bfa1a56de479709442861a8065238b49b9 100644 (file)
@@ -206,7 +206,7 @@ int copy_data_fd(int fd) {
                         /* Hmm, pity, this didn't fit. Let's fall back to /tmp then, see below */
 
                 } else {
-                        _cleanup_(close_pairp) int pipefds[2] = PIPE_EBADF;
+                        _cleanup_close_pair_ int pipefds[2] = PIPE_EBADF;
                         int isz;
 
                         /* If memfds aren't available, use a pipe. Set O_NONBLOCK so that we will get EAGAIN rather
index 5885215a1ca24876bebbee9b847a02b5927863b6..68d186117f5cf618abd96d98ac6cc017613d4fa2 100644 (file)
@@ -570,7 +570,7 @@ static int parse_core(int fd, const char *executable, char **ret, JsonVariant **
         };
 
         _cleanup_(json_variant_unrefp) JsonVariant *package_metadata = NULL;
-        _cleanup_(set_freep) Set *modules = NULL;
+        _cleanup_set_free_ Set *modules = NULL;
         _cleanup_free_ char *buf = NULL; /* buf should be freed last, c.f closed first (via stack_context_destroy) */
         _cleanup_(stack_context_destroy) StackContext c = {
                 .package_metadata = &package_metadata,
@@ -636,7 +636,7 @@ static int parse_core(int fd, const char *executable, char **ret, JsonVariant **
 
 static int parse_elf(int fd, const char *executable, char **ret, JsonVariant **ret_package_metadata) {
         _cleanup_(json_variant_unrefp) JsonVariant *package_metadata = NULL, *elf_metadata = NULL;
-        _cleanup_(set_freep) Set *modules = NULL;
+        _cleanup_set_free_ Set *modules = NULL;
         _cleanup_free_ char *buf = NULL; /* buf should be freed last, c.f closed first (via stack_context_destroy) */
         _cleanup_(stack_context_destroy) StackContext c = {
                 .package_metadata = &package_metadata,
index 6222ef4fc81c4d50864833e4ec76e7dfc72e0227..31008625483ecf935e997f30d7469d8cd4745fff 100644 (file)
@@ -64,7 +64,7 @@ static int keymap_recurse_dir_callback(
 }
 
 int get_keymaps(char ***ret) {
-        _cleanup_(set_free_freep) Set *keymaps = NULL;
+        _cleanup_set_free_free_ Set *keymaps = NULL;
         int r;
 
         keymaps = set_new(&string_hash_ops);
index 6802ad0d3da79385a865b74f942f6146362e8d6e..57c40584879abfa87085a6ab39a9f09791eadaaa 100644 (file)
@@ -820,7 +820,7 @@ int fido2_generate_hmac_hash(
                                                "Token asks for PIN but doesn't advertise 'clientPin' feature.");
 
                 for (;;) {
-                        _cleanup_(strv_free_erasep) char **pin = NULL;
+                        _cleanup_strv_free_erase_ char **pin = NULL;
 
                         r = ask_password_auto("Please enter security token PIN:", askpw_icon_name, NULL, "fido2-pin", "fido2-pin", USEC_INFINITY, 0, &pin);
                         if (r < 0)
index 08e89dc228a83fd17ec9f11d16a9cd907f490806..6ee4307c68269e0afec690d7a65125a60e09240b 100644 (file)
@@ -548,7 +548,7 @@ int make_filesystem(
 }
 
 int mkfs_options_from_env(const char *component, const char *fstype, char ***ret) {
-        _cleanup_(strv_freep) char **l = NULL;
+        _cleanup_strv_free_ char **l = NULL;
         const char *e;
         char *n;
 
index 2e3b47ddcac09a7cb58222def9cc57de269b5356..d388c89192bc18fbd32cd901a9afbb395ccbe041 100644 (file)
@@ -222,7 +222,7 @@ int battery_is_discharging_and_low(void) {
 /* Store current capacity of each battery before suspension and timestamp */
 int fetch_batteries_capacity_by_name(Hashmap **ret) {
         _cleanup_(sd_device_enumerator_unrefp) sd_device_enumerator *e = NULL;
-        _cleanup_(hashmap_freep) Hashmap *batteries_capacity_by_name = NULL;
+        _cleanup_hashmap_free_ Hashmap *batteries_capacity_by_name = NULL;
         sd_device *dev;
         int r;
 
index c21f5b2274f282836711dca289dc4027a01a4533..680cc726c3a31b198c31f7bab12e12fd5679e611 100644 (file)
@@ -2847,7 +2847,7 @@ int tpm2_unseal(const char *device,
 int tpm2_list_devices(void) {
 #if HAVE_TPM2
         _cleanup_(table_unrefp) Table *t = NULL;
-        _cleanup_(closedirp) DIR *d = NULL;
+        _cleanup_closedir_ DIR *d = NULL;
         int r;
 
         r = dlopen_tpm2();
@@ -2923,7 +2923,7 @@ int tpm2_find_device_auto(
                 int log_level, /* log level when no device is found */
                 char **ret) {
 #if HAVE_TPM2
-        _cleanup_(closedirp) DIR *d = NULL;
+        _cleanup_closedir_ DIR *d = NULL;
         int r;
 
         r = dlopen_tpm2();
index a7896297ae3afa303db6d60e0ce688350bc088bf..dfff5aba72beb257ef1620b3943296a6c11e95f7 100644 (file)
@@ -395,8 +395,8 @@ static int userdb_start_query(
                 JsonVariant *query,
                 UserDBFlags flags) {
 
-        _cleanup_(strv_freep) char **except = NULL, **only = NULL;
-        _cleanup_(closedirp) DIR *d = NULL;
+        _cleanup_strv_free_ char **except = NULL, **only = NULL;
+        _cleanup_closedir_ DIR *d = NULL;
         const char *e;
         int r, ret = 0;
 
index 93e082d77eaa353528a71f757ec31779bfe2177d..221d29ba6c03ef5e43114ffa9b07eca9b75f246f 100644 (file)
@@ -605,7 +605,7 @@ static void log_umount_blockers(const char *mnt) {
 }
 
 static int remount_with_timeout(MountPoint *m, bool last_try) {
-        _cleanup_(close_pairp) int pfd[2] = PIPE_EBADF;
+        _cleanup_close_pair_ int pfd[2] = PIPE_EBADF;
         _cleanup_(sigkill_nowaitp) pid_t pid = 0;
         int r;
 
@@ -661,7 +661,7 @@ static int remount_with_timeout(MountPoint *m, bool last_try) {
 }
 
 static int umount_with_timeout(MountPoint *m, bool last_try) {
-        _cleanup_(close_pairp) int pfd[2] = PIPE_EBADF;
+        _cleanup_close_pair_ int pfd[2] = PIPE_EBADF;
         _cleanup_(sigkill_nowaitp) pid_t pid = 0;
         int r;
 
index d752ad274244b8e6867846a0eaaa22521558f30f..c9b277b124aff394b947c1d562ad0462f5d99803 100644 (file)
@@ -443,7 +443,7 @@ static int parse_argv(int argc, char *argv[]) {
 }
 
 static int run(int argc, char *argv[]) {
-        _cleanup_(ordered_hashmap_freep) OrderedHashmap *sysctl_options = NULL;
+        _cleanup_ordered_hashmap_free_ OrderedHashmap *sysctl_options = NULL;
         int r, k;
 
         r = parse_argv(argc, argv);
index f5b2248040462260273095a69757098593a31d47..ec231da7a80964a3b9e7531db787ccc627c8d2c4 100644 (file)
@@ -788,7 +788,7 @@ static int merge(Hashmap *images) {
 }
 
 static int image_discover_and_read_metadata(Hashmap **ret_images) {
-        _cleanup_(hashmap_freep) Hashmap *images = NULL;
+        _cleanup_hashmap_free_ Hashmap *images = NULL;
         Image *img;
         int r;
 
@@ -814,7 +814,7 @@ static int image_discover_and_read_metadata(Hashmap **ret_images) {
 }
 
 static int verb_merge(int argc, char **argv, void *userdata) {
-        _cleanup_(hashmap_freep) Hashmap *images = NULL;
+        _cleanup_hashmap_free_ Hashmap *images = NULL;
         int r;
 
         r = have_effective_cap(CAP_SYS_ADMIN);
@@ -852,7 +852,7 @@ static int verb_merge(int argc, char **argv, void *userdata) {
 }
 
 static int verb_refresh(int argc, char **argv, void *userdata) {
-        _cleanup_(hashmap_freep) Hashmap *images = NULL;
+        _cleanup_hashmap_free_ Hashmap *images = NULL;
         int r;
 
         r = have_effective_cap(CAP_SYS_ADMIN);
@@ -892,7 +892,7 @@ static int verb_refresh(int argc, char **argv, void *userdata) {
 }
 
 static int verb_list(int argc, char **argv, void *userdata) {
-        _cleanup_(hashmap_freep) Hashmap *images = NULL;
+        _cleanup_hashmap_free_ Hashmap *images = NULL;
         _cleanup_(table_unrefp) Table *t = NULL;
         Image *img;
         int r;
index aff823d773d627952413f3357d8a08396dcf9713..e3f25d52d5242568482082bce20644c4df4d9f03 100644 (file)
@@ -14,7 +14,7 @@
 #include "terminal-util.h"
 
 int verb_cat(int argc, char *argv[], void *userdata) {
-        _cleanup_(hashmap_freep) Hashmap *cached_name_map = NULL, *cached_id_map = NULL;
+        _cleanup_hashmap_free_ Hashmap *cached_name_map = NULL, *cached_id_map = NULL;
         _cleanup_(lookup_paths_free) LookupPaths lp = {};
         _cleanup_strv_free_ char **names = NULL;
         sd_bus *bus;
@@ -197,7 +197,7 @@ static int find_paths_to_edit(
                 EditFileContext *context,
                 char **names) {
 
-        _cleanup_(hashmap_freep) Hashmap *cached_name_map = NULL, *cached_id_map = NULL;
+        _cleanup_hashmap_free_ Hashmap *cached_name_map = NULL, *cached_id_map = NULL;
         _cleanup_(lookup_paths_free) LookupPaths lp = {};
         _cleanup_free_ char *drop_in_alloc = NULL, *suffix = NULL;
         const char *drop_in;
index aad248fe1f56989b0a2406cf23cc2609b0534742..fc1ad9800abc2c7c79e23617bcb68a949df763d9 100644 (file)
@@ -143,7 +143,7 @@ static int output_unit_file_list(const UnitFileList *units, unsigned c) {
 int verb_list_unit_files(int argc, char *argv[], void *userdata) {
         _cleanup_(sd_bus_message_unrefp) sd_bus_message *reply = NULL;
         _cleanup_free_ UnitFileList *units = NULL;
-        _cleanup_(hashmap_freep) Hashmap *h = NULL;
+        _cleanup_hashmap_free_ Hashmap *h = NULL;
         unsigned c = 0;
         const char *state;
         char *path;
index 5f06377ade9c600af353ca5a0864816ae105104f..201b37528a877d2acc90bd571e53e99cf4ff342f 100644 (file)
@@ -72,7 +72,7 @@ static int resource_load_from_directory(
                 Resource *rr,
                 mode_t m) {
 
-        _cleanup_(closedirp) DIR *d = NULL;
+        _cleanup_closedir_ DIR *d = NULL;
         int r;
 
         assert(rr);
@@ -242,7 +242,7 @@ static int download_manifest(
                 size_t *ret_size) {
 
         _cleanup_free_ char *buffer = NULL, *suffixed_url = NULL;
-        _cleanup_(close_pairp) int pfd[2] = PIPE_EBADF;
+        _cleanup_close_pair_ int pfd[2] = PIPE_EBADF;
         _cleanup_fclose_ FILE *manifest = NULL;
         size_t size = 0;
         pid_t pid;
index 8ae58c2b1b8a30027b6320c3a95d96af20d4b8b6..f7009315a2e596bc7e73ff342cc32e68c3aa84ed 100644 (file)
@@ -570,7 +570,7 @@ int transfer_resolve_paths(
 }
 
 static void transfer_remove_temporary(Transfer *t) {
-        _cleanup_(closedirp) DIR *d = NULL;
+        _cleanup_closedir_ DIR *d = NULL;
         int r;
 
         assert(t);
index 76777dc08e94a23725f75bd48a3629fab9fe04ba..023eaac5866b1f8517feb677926d42105d1d7415 100644 (file)
@@ -1093,7 +1093,7 @@ static int component_name_valid(const char *c) {
 static int verb_components(int argc, char **argv, void *userdata) {
         _cleanup_(loop_device_unrefp) LoopDevice *loop_device = NULL;
         _cleanup_(umount_and_rmdir_and_freep) char *mounted_dir = NULL;
-        _cleanup_(set_freep) Set *names = NULL;
+        _cleanup_set_free_ Set *names = NULL;
         _cleanup_free_ char **z = NULL; /* We use simple free() rather than strv_free() here, since set_free() will free the strings for us */
         char **l = CONF_PATHS_STRV("");
         bool has_default_component = false;
index c0febec2080d77ebcc4625fbafddaebdfe24e75e..c5a4b0846936827bd26ba6576b9b41bee982494c 100644 (file)
@@ -81,7 +81,7 @@ static void assert_equal_fd(int fd1, int fd2) {
 
 TEST(copy_data_fd) {
         _cleanup_close_ int fd1 = -EBADF, fd2 = -EBADF;
-        _cleanup_(close_pairp) int sfd[2] = PIPE_EBADF;
+        _cleanup_close_pair_ int sfd[2] = PIPE_EBADF;
         _cleanup_(sigkill_waitp) pid_t pid = -1;
         int r;
 
index d5e5dcaa6805914f23a9255b42b494719cc191a1..560a64b959f7b777e2fbb40a64dd327ddac76121 100644 (file)
@@ -11,7 +11,7 @@
 #include "tests.h"
 
 TEST(hashmap_replace) {
-        _cleanup_(hashmap_freep) Hashmap *m = NULL;
+        _cleanup_hashmap_free_ Hashmap *m = NULL;
         _cleanup_free_ char *val1 = NULL, *val2 = NULL, *val3 = NULL, *val4 = NULL, *val5 = NULL;
         char *r;
 
@@ -43,8 +43,8 @@ TEST(hashmap_replace) {
 }
 
 TEST(hashmap_copy) {
-        _cleanup_(hashmap_freep) Hashmap *m = NULL;
-        _cleanup_(hashmap_free_freep) Hashmap *copy = NULL;
+        _cleanup_hashmap_free_ Hashmap *m = NULL;
+        _cleanup_hashmap_free_free_ Hashmap *copy = NULL;
         char *val1, *val2, *val3, *val4, *r;
 
         val1 = strdup("val1");
@@ -76,8 +76,8 @@ TEST(hashmap_copy) {
 }
 
 TEST(hashmap_get_strv) {
-        _cleanup_(hashmap_freep) Hashmap *m = NULL;
-        _cleanup_(strv_freep) char **strv = NULL;
+        _cleanup_hashmap_free_ Hashmap *m = NULL;
+        _cleanup_strv_free_ char **strv = NULL;
         char *val1, *val2, *val3, *val4;
 
         val1 = strdup("val1");
@@ -109,7 +109,7 @@ TEST(hashmap_get_strv) {
 }
 
 TEST(hashmap_move_one) {
-        _cleanup_(hashmap_free_freep) Hashmap *m = NULL, *n = NULL;
+        _cleanup_hashmap_free_free_ Hashmap *m = NULL, *n = NULL;
         char *val1, *val2, *val3, *val4, *r;
 
         val1 = strdup("val1");
@@ -145,7 +145,7 @@ TEST(hashmap_move_one) {
 }
 
 TEST(hashmap_move) {
-        _cleanup_(hashmap_free_freep) Hashmap *m = NULL, *n = NULL;
+        _cleanup_hashmap_free_free_ Hashmap *m = NULL, *n = NULL;
         char *val1, *val2, *val3, *val4, *r;
 
         val1 = strdup("val1");
@@ -184,7 +184,7 @@ TEST(hashmap_move) {
 }
 
 TEST(hashmap_update) {
-        _cleanup_(hashmap_freep) Hashmap *m = NULL;
+        _cleanup_hashmap_free_ Hashmap *m = NULL;
         _cleanup_free_ char *val1 = NULL, *val2 = NULL;
         char *r;
 
@@ -208,7 +208,7 @@ TEST(hashmap_update) {
 }
 
 TEST(hashmap_put) {
-        _cleanup_(hashmap_freep) Hashmap *m = NULL;
+        _cleanup_hashmap_free_ Hashmap *m = NULL;
         int valid_hashmap_put;
         void *val1 = (void*) "val 1";
         void *val2 = (void*) "val 2";
@@ -417,7 +417,7 @@ TEST(hashmap_ensure_allocated) {
 }
 
 TEST(hashmap_foreach_key) {
-        _cleanup_(hashmap_freep) Hashmap *m = NULL;
+        _cleanup_hashmap_free_ Hashmap *m = NULL;
         bool key_found[] = { false, false, false, false };
         const char *s;
         const char *key;
@@ -449,7 +449,7 @@ TEST(hashmap_foreach_key) {
 }
 
 TEST(hashmap_foreach) {
-        _cleanup_(hashmap_free_freep) Hashmap *m = NULL;
+        _cleanup_hashmap_free_free_ Hashmap *m = NULL;
         bool value_found[] = { false, false, false, false };
         char *val1, *val2, *val3, *val4, *s;
         unsigned count;
@@ -496,8 +496,8 @@ TEST(hashmap_foreach) {
 }
 
 TEST(hashmap_merge) {
-        _cleanup_(hashmap_free_freep) Hashmap *m = NULL;
-        _cleanup_(hashmap_freep) Hashmap *n = NULL;
+        _cleanup_hashmap_free_free_ Hashmap *m = NULL;
+        _cleanup_hashmap_free_ Hashmap *n = NULL;
         char *val1, *val2, *val3, *val4, *r;
 
         val1 = strdup("my val1");
@@ -528,7 +528,7 @@ TEST(hashmap_merge) {
 }
 
 TEST(hashmap_contains) {
-        _cleanup_(hashmap_free_freep) Hashmap *m = NULL;
+        _cleanup_hashmap_free_free_ Hashmap *m = NULL;
         char *val1;
 
         val1 = strdup("my val");
@@ -547,7 +547,7 @@ TEST(hashmap_contains) {
 }
 
 TEST(hashmap_isempty) {
-        _cleanup_(hashmap_free_freep) Hashmap *m = NULL;
+        _cleanup_hashmap_free_free_ Hashmap *m = NULL;
         char *val1;
 
         val1 = strdup("my val");
@@ -563,7 +563,7 @@ TEST(hashmap_isempty) {
 }
 
 TEST(hashmap_size) {
-        _cleanup_(hashmap_free_freep) Hashmap *m = NULL;
+        _cleanup_hashmap_free_free_ Hashmap *m = NULL;
         char *val1, *val2, *val3, *val4;
 
         val1 = strdup("my val");
@@ -591,7 +591,7 @@ TEST(hashmap_size) {
 }
 
 TEST(hashmap_get) {
-        _cleanup_(hashmap_free_freep) Hashmap *m = NULL;
+        _cleanup_hashmap_free_free_ Hashmap *m = NULL;
         char *r;
         char *val;
 
index 80166b17c68b4b9055b0df73657de5b0e36755e6..efd75b2a6798b70205d5bea42e697b572ffc2f46 100644 (file)
@@ -578,7 +578,7 @@ TEST(preset_and_list) {
         UnitFileState state;
         bool got_yes = false, got_no = false;
         UnitFileList *fl;
-        _cleanup_(hashmap_freep) Hashmap *h = NULL;
+        _cleanup_hashmap_free_ Hashmap *h = NULL;
 
         CLEANUP_ARRAY(changes, n_changes, install_changes_free);
 
index 9fba0a8ca88c7ce214bfab8b633bf2814db8c04a..b54252efc8bd2259ada506b3d77cd44c73df3d27 100644 (file)
@@ -20,7 +20,7 @@ static void dump_changes(InstallChange *c, unsigned n) {
 }
 
 int main(int argc, char* argv[]) {
-        _cleanup_(hashmap_freep) Hashmap *h = NULL;
+        _cleanup_hashmap_free_ Hashmap *h = NULL;
         UnitFileList *p;
         int r;
         const char *const files[] = { "avahi-daemon.service", NULL };
index 708abb7026e2b4611ec90f81aab74943b3b33ea5..e4ee9f697d68658239a9b71d582bba40852eb2af 100644 (file)
@@ -41,7 +41,7 @@ STATIC_DESTRUCTOR_REGISTER(runtime_dir, rm_rf_physical_and_freep);
 
 TEST_RET(unit_file_get_set) {
         int r;
-        _cleanup_(hashmap_freep) Hashmap *h = NULL;
+        _cleanup_hashmap_free_ Hashmap *h = NULL;
         UnitFileList *p;
 
         h = hashmap_new(&unit_file_list_hash_ops_free);
index fad5496052a1d177d1973d747e77c999b4be55d0..f76d3543eb9f5f8680b6a3d77afa42af7cc8eac6 100644 (file)
@@ -143,7 +143,7 @@ static int run(int argc, char *argv[]) {
         sd_id128_t id;
 #endif
         _cleanup_free_ char *p = NULL, *cmd = NULL;
-        _cleanup_(pclosep) FILE *sfdisk = NULL;
+        _cleanup_pclose_ FILE *sfdisk = NULL;
         _cleanup_(loop_device_unrefp) LoopDevice *loop = NULL;
         _cleanup_close_ int fd = -EBADF;
         int r;
index 259ffa7ce20af293ce5846bbfabcdfa33fd8998d..0d5a6a185608902a5c844984f3e101e7f70422f7 100644 (file)
@@ -145,8 +145,8 @@ TEST(set_ensure_allocated) {
 }
 
 TEST(set_copy) {
-        _cleanup_(set_freep) Set *s = NULL;
-        _cleanup_(set_free_freep) Set *copy = NULL;
+        _cleanup_set_free_ Set *s = NULL;
+        _cleanup_set_free_free_ Set *copy = NULL;
         char *key1, *key2, *key3, *key4;
 
         key1 = strdup("key1");
index 5feafc95e0184522865c023442c7794007766eb3..cfd662b329d952d091469b9d4d2e0693c0b89b12 100644 (file)
@@ -260,7 +260,7 @@ TEST(invalid_unquote) {
 }
 
 TEST(strv_split) {
-        _cleanup_(strv_free_erasep) char **l = NULL;
+        _cleanup_strv_free_erase_ char **l = NULL;
         const char str[] = "one,two,three";
 
         l = strv_split(str, ",");
index 679d235c78e055a7a43f9e84b556443956e90a71..631305e8f0f0784bfdb5458f83e8c0c82e02f780 100644 (file)
@@ -272,7 +272,7 @@ int main(int argc, char *argv[]) {
         _cleanup_(rm_rf_physical_and_freep) char *tmpdir = NULL;
         _cleanup_(json_variant_unrefp) JsonVariant *v = NULL;
         _cleanup_(sd_event_unrefp) sd_event *e = NULL;
-        _cleanup_(close_pairp) int block_fds[2] = PIPE_EBADF;
+        _cleanup_close_pair_ int block_fds[2] = PIPE_EBADF;
         pthread_t t;
         const char *sp;
 
index edf0dfb73d636f1842dba441a68d9dd0d9bea254..7b5592b9c289b705d45cfdb8980881a168ac9f9d 100644 (file)
@@ -35,7 +35,7 @@ static int open_passwd_file(const char *root, const char *fname, FILE **ret_file
 }
 
 static int populate_uid_cache(const char *root, Hashmap **ret) {
-        _cleanup_(hashmap_freep) Hashmap *cache = NULL;
+        _cleanup_hashmap_free_ Hashmap *cache = NULL;
         int r;
 
         cache = hashmap_new(&uid_gid_hash_ops);
@@ -76,7 +76,7 @@ static int populate_uid_cache(const char *root, Hashmap **ret) {
 }
 
 static int populate_gid_cache(const char *root, Hashmap **ret) {
-        _cleanup_(hashmap_freep) Hashmap *cache = NULL;
+        _cleanup_hashmap_free_ Hashmap *cache = NULL;
         int r;
 
         cache = hashmap_new(&uid_gid_hash_ops);
index b70cef47531ea3dccd1cf9b3a77e363661257d9e..ef495825103e139e00e683bce195c93a9ad529d1 100644 (file)
@@ -17,7 +17,7 @@ static void test_resolve_one(const char *name) {
 
         log_info("/* %s(\"%s\") */", __func__, name);
 
-        _cleanup_(hashmap_freep) Hashmap *uid_cache = NULL, *gid_cache = NULL;
+        _cleanup_hashmap_free_ Hashmap *uid_cache = NULL, *gid_cache = NULL;
         uid_t uid = UID_INVALID;
         gid_t gid = GID_INVALID;
         int r;
index 1cb8f06b3e9005c06b433d24d7c346236438d820..af1b904d329933219a6359b6023d4bb584a91fce 100644 (file)
@@ -4055,7 +4055,7 @@ static int read_config_file(
                 bool ignore_enoent,
                 bool *invalid_config) {
 
-        _cleanup_(hashmap_freep) Hashmap *uid_cache = NULL, *gid_cache = NULL;
+        _cleanup_hashmap_free_ Hashmap *uid_cache = NULL, *gid_cache = NULL;
         _cleanup_fclose_ FILE *_f = NULL;
         _cleanup_free_ char *pp = NULL;
         unsigned v = 0;
index b9f18d1552c50a95545d0eff0e9c07bd494e0769..81b21f0ab0130b0d744713882603004447c048c1 100644 (file)
@@ -287,7 +287,7 @@ static int lock_device(
 }
 
 int lock_main(int argc, char *argv[], void *userdata) {
-        _cleanup_(fdset_freep) FDSet *fds = NULL;
+        _cleanup_fdset_free_ FDSet *fds = NULL;
         _cleanup_free_ dev_t *devnos = NULL;
         size_t n_devnos = 0;
         usec_t deadline;
index 67675b4b7f7ea6237e5e9585e5b52650ef468827..a7db3fb0d52168ddcb19c552d034336322933553 100644 (file)
@@ -910,7 +910,7 @@ static int display_memberships(int argc, char *argv[], void *userdata) {
 
 static int display_services(int argc, char *argv[], void *userdata) {
         _cleanup_(table_unrefp) Table *t = NULL;
-        _cleanup_(closedirp) DIR *d = NULL;
+        _cleanup_closedir_ DIR *d = NULL;
         int r;
 
         d = opendir("/run/systemd/userdb/");
index 918f6599ce66a24d2fc1174e8f12dc7500f9b465..616c0173577784bcbd2b369db182b3574565277b 100644 (file)
@@ -95,7 +95,7 @@ static int enumerate_xdg_autostart(Hashmap *all_services) {
 }
 
 static int run(const char *dest, const char *dest_early, const char *dest_late) {
-        _cleanup_(hashmap_freep) Hashmap *all_services = NULL;
+        _cleanup_hashmap_free_ Hashmap *all_services = NULL;
         XdgAutostartService *service;
         int r;