]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
shared/install: drop unnecessary casts
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 2 Mar 2022 16:19:56 +0000 (17:19 +0100)
committerLennart Poettering <lennart@poettering.net>
Fri, 18 Mar 2022 09:22:20 +0000 (10:22 +0100)
The compiler coerces to bool for us, no need to do it explicitly.

src/shared/install.c

index 1f5828de568830006b6e62f23ef29d0fcf353b5a..f614e6fcfa1d7665b1a8807973f17b72bf97aaaa 100644 (file)
@@ -2190,7 +2190,7 @@ int unit_file_mask(
                 if (!path)
                         return -ENOMEM;
 
-                q = create_symlink(&lp, "/dev/null", path, !!(flags & UNIT_FILE_FORCE), changes, n_changes);
+                q = create_symlink(&lp, "/dev/null", path, flags & UNIT_FILE_FORCE, changes, n_changes);
                 if (q < 0 && r >= 0)
                         r = q;
         }
@@ -2211,7 +2211,6 @@ int unit_file_unmask(
         _cleanup_strv_free_ char **todo = NULL;
         const char *config_path;
         size_t n_todo = 0;
-        bool dry_run;
         char **i;
         int r, q;
 
@@ -2226,7 +2225,7 @@ int unit_file_unmask(
         if (!config_path)
                 return -ENXIO;
 
-        dry_run = !!(flags & UNIT_FILE_DRY_RUN);
+        bool dry_run = flags & UNIT_FILE_DRY_RUN;
 
         STRV_FOREACH(i, files) {
                 _cleanup_free_ char *path = NULL;
@@ -2366,7 +2365,7 @@ int unit_file_link(
                 if (!new_path)
                         return -ENOMEM;
 
-                q = create_symlink(&lp, *i, new_path, !!(flags & UNIT_FILE_FORCE), changes, n_changes);
+                q = create_symlink(&lp, *i, new_path, flags & UNIT_FILE_FORCE, changes, n_changes);
                 if (q < 0 && r >= 0)
                         r = q;
         }
@@ -2700,7 +2699,7 @@ int unit_file_disable(
         if (r < 0)
                 return r;
 
-        return remove_marked_symlinks(remove_symlinks_to, config_path, &lp, !!(flags & UNIT_FILE_DRY_RUN), changes, n_changes);
+        return remove_marked_symlinks(remove_symlinks_to, config_path, &lp, flags & UNIT_FILE_DRY_RUN, changes, n_changes);
 }
 
 int unit_file_reenable(
@@ -2762,7 +2761,7 @@ int unit_file_set_default(
                 return r;
 
         new_path = strjoina(lp.persistent_config, "/" SPECIAL_DEFAULT_TARGET);
-        return create_symlink(&lp, i->path, new_path, !!(flags & UNIT_FILE_FORCE), changes, n_changes);
+        return create_symlink(&lp, i->path, new_path, flags & UNIT_FILE_FORCE, changes, n_changes);
 }
 
 int unit_file_get_default(