]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
tree-wide: use _cleanup_hashmap_free_ and friends
authorYu Watanabe <watanabe.yu+github@gmail.com>
Sat, 18 Jan 2025 18:37:24 +0000 (03:37 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Sat, 18 Jan 2025 18:48:15 +0000 (03:48 +0900)
14 files changed:
src/ask-password/ask-password.c
src/basic/namespace-util.c
src/core/exec-invoke.c
src/creds/creds.c
src/import/importd.c
src/libsystemd/sd-bus/bus-socket.c
src/libsystemd/sd-varlink/sd-varlink-idl.c
src/login/pam_systemd_loadkey.c
src/mountfsd/mountwork.c
src/nsresourced/nsresourced-manager.c
src/pcrlock/pcrlock.c
src/resolve/resolved-dns-stream.c
src/shared/openssl-util.c
src/test/test-hashmap-plain.c

index 551dcb8b2727c93ceb116fa4ed0c57f46a7516d8..55ff91d76c8040037cd562d1a31932a4e55153a9 100644 (file)
@@ -376,7 +376,7 @@ static int vl_method_ask(sd_varlink *link, sd_json_variant *parameters, sd_varli
 
 static int vl_server(void) {
         _cleanup_(sd_varlink_server_unrefp) sd_varlink_server *varlink_server = NULL;
-        _cleanup_(hashmap_freep) Hashmap *polkit_registry = NULL;
+        _cleanup_hashmap_free_ Hashmap *polkit_registry = NULL;
         int r;
 
         r = varlink_server_new(&varlink_server, SD_VARLINK_SERVER_INHERIT_USERDATA, /* userdata= */ &polkit_registry);
index 6c559e4bf882d7ff543449a3aa52faacae3e532b..99cece16740ab8f0e54117d13ab6031e995bb70b 100644 (file)
@@ -558,7 +558,7 @@ int userns_acquire(const char *uid_map, const char *gid_map) {
 }
 
 int userns_enter_and_pin(int userns_fd, pid_t *ret_pid) {
-        _cleanup_(close_pairp) int pfd[2] = EBADF_PAIR;
+        _cleanup_close_pair_ int pfd[2] = EBADF_PAIR;
         _cleanup_(sigkill_waitp) pid_t pid = 0;
         ssize_t n;
         char x;
index 7f79ae4962c1b4e88f6288ae310fc9daa23ae915..da408fbee2499f83b23621872464fcd0e5392005 100644 (file)
@@ -1120,7 +1120,7 @@ static int ask_password_conv(
                                 .until = now(CLOCK_MONOTONIC) + 15 * USEC_PER_SEC,
                         };
 
-                        _cleanup_(strv_free_erasep) char **acquired = NULL;
+                        _cleanup_strv_free_erase_ char **acquired = NULL;
                         r = ask_password_auto(
                                         &req,
                                         ASK_PASSWORD_ACCEPT_CACHED|
index bf76e4acf08b14c9cfdb70bdff3b8b098a735743..b10c36e66f440d556a36d7b602419b72fc11de12 100644 (file)
@@ -1425,7 +1425,7 @@ static int run(int argc, char *argv[]) {
 
         if (arg_varlink) {
                 _cleanup_(sd_varlink_server_unrefp) sd_varlink_server *varlink_server = NULL;
-                _cleanup_(hashmap_freep) Hashmap *polkit_registry = NULL;
+                _cleanup_hashmap_free_ Hashmap *polkit_registry = NULL;
 
                 /* Invocation as Varlink service */
 
index ea8257a833dfb519f57e2a2fef8447f6083b3f85..c3a771782643d534856603636b46da61b9038a8f 100644 (file)
@@ -1370,7 +1370,7 @@ static int method_list_images(sd_bus_message *msg, void *userdata, sd_bus_error
              class < 0 ? (c < _IMAGE_CLASS_MAX) : (c == class);
              c++) {
 
-                _cleanup_(hashmap_freep) Hashmap *h = NULL;
+                _cleanup_hashmap_free_ Hashmap *h = NULL;
 
                 h = hashmap_new(&image_hash_ops);
                 if (!h)
index ecaf5b33b4ab98e3204cb788a66d1fb1af5861aa..d5098ba650e0afd564556069e5b6d6d08f9ba79e 100644 (file)
@@ -1010,7 +1010,7 @@ static int bind_description(sd_bus *b, int fd, int family) {
 }
 
 static int connect_as(int fd, const struct sockaddr *sa, socklen_t salen, uid_t uid, gid_t gid) {
-        _cleanup_(close_pairp) int pfd[2] = EBADF_PAIR;
+        _cleanup_close_pair_ int pfd[2] = EBADF_PAIR;
         ssize_t n;
         int r;
 
index 1349fd36ab5cfaa01e0d9158138e0d0fbe5da6e0..c7126ac6e61715a553f7e40c14e3c2c3fd13fdc9 100644 (file)
@@ -1607,7 +1607,7 @@ static int varlink_idl_symbol_consistent(
                 const sd_varlink_symbol *symbol,
                 int level) {
 
-        _cleanup_(set_freep) Set *input_set = NULL, *output_set = NULL;
+        _cleanup_set_free_ Set *input_set = NULL, *output_set = NULL;
         const char *symbol_name;
         int r;
 
@@ -1654,7 +1654,7 @@ static int varlink_idl_symbol_consistent(
 }
 
 int varlink_idl_consistent(const sd_varlink_interface *interface, int level) {
-        _cleanup_(set_freep) Set *name_set = NULL;
+        _cleanup_set_free_ Set *name_set = NULL;
         int r;
 
         assert(interface);
index 3b11d764532dc447b25ce62b02c86271fc80c8e0..f62007d15583b557378ca3faa343d47152b02fc6 100644 (file)
@@ -73,7 +73,7 @@ _public_ PAM_EXTERN int pam_sm_authenticate(
 
         /* Split the key by NUL. Set the last item as authtok. */
 
-        _cleanup_(strv_free_erasep) char **passwords = strv_parse_nulstr(p, n);
+        _cleanup_strv_free_erase_ char **passwords = strv_parse_nulstr(p, n);
         if (!passwords)
                 return pam_log_oom(handle);
 
index 9b674c83b552521610832d2232d8ff533bb3e6b1..31f2d47546c38146170539f29508e48844ae0a59 100644 (file)
@@ -567,7 +567,7 @@ static int process_connection(sd_varlink_server *server, int _fd) {
 static int run(int argc, char *argv[]) {
         usec_t start_time, listen_idle_usec, last_busy_usec = USEC_INFINITY;
         _cleanup_(sd_varlink_server_unrefp) sd_varlink_server *server = NULL;
-        _cleanup_(hashmap_freep) Hashmap *polkit_registry = NULL;
+        _cleanup_hashmap_free_ Hashmap *polkit_registry = NULL;
         _cleanup_(pidref_done) PidRef parent = PIDREF_NULL;
         unsigned n_iterations = 0;
         int m, listen_fd, r;
index ab1cd0a7c139cbef6d4b5257b83afa4480b0a01a..152b506da52d247ce8b66e73d7daa51bf19fd507 100644 (file)
@@ -595,7 +595,7 @@ static int manager_setup_bpf(Manager *m) {
 #endif
 
 int manager_startup(Manager *m) {
-        _cleanup_(set_freep) Set *fdstore_inodes = NULL, *registry_inodes = NULL;
+        _cleanup_set_free_ Set *fdstore_inodes = NULL, *registry_inodes = NULL;
         void *p;
         int r;
 
index 72b13f8fac49e4dfe988a7bdfe91dafd363902ad..92634b53f4c6050e6df4f45381e7b5d4d8deecc2 100644 (file)
@@ -4548,7 +4548,7 @@ static int make_policy(bool force, RecoveryPinMode recovery_pin_mode) {
                 if (r < 0)
                         return log_error_errno(r, "Failed to acquire PIN from environment: %m");
                 if (r == 0) {
-                        _cleanup_(strv_free_erasep) char **l = NULL;
+                        _cleanup_strv_free_erase_ char **l = NULL;
 
                         AskPasswordRequest req = {
                                 .tty_fd = -EBADF,
index e57af6622180ad5e5f55968cc173ea75be3d2ecf..0696857802fe014d28e9e29879b0e9bf9fbd417a 100644 (file)
@@ -612,7 +612,7 @@ DEFINE_PRIVATE_HASH_OPS_WITH_KEY_DESTRUCTOR(
                 dns_stream_unref);
 
 int dns_stream_disconnect_all(Manager *m) {
-        _cleanup_(set_freep) Set *closed = NULL;
+        _cleanup_set_free_ Set *closed = NULL;
         int r;
 
         assert(m);
index b60fc67b26c93f801b69b7cb590a9b87347bac30..302cf3d0f6f8d5a5c404375aa97eab292d48f26c 100644 (file)
@@ -1398,7 +1398,7 @@ static int openssl_ask_password_ui_read(UI *ui, UI_STRING *uis) {
 
                 req->message = UI_get0_output_string(uis);
 
-                _cleanup_(strv_freep) char **l = NULL;
+                _cleanup_strv_free_ char **l = NULL;
                 r = ask_password_auto(req, ASK_PASSWORD_ACCEPT_CACHED|ASK_PASSWORD_PUSH_CACHE, &l);
                 if (r < 0) {
                         log_error_errno(r, "Failed to query for PIN: %m");
index e1485a84d4fc954b28c43f84a5c82525083726bd..81effec21ab0970f515c5a301a76c29c93a5c890 100644 (file)
@@ -646,7 +646,7 @@ TEST(hashmap_get) {
 }
 
 TEST(hashmap_get2) {
-        _cleanup_(hashmap_free_free_freep) Hashmap *m = NULL;
+        _cleanup_hashmap_free_free_free_ Hashmap *m = NULL;
         char *r;
         char *val;
         char key_orig[] = "Key 1";