richardphibel / rpms / systemd

Forked from rpms/systemd 2 years ago
Clone
594167
From 34c379b77a4bfacb675cb6e5a363317d7dcc9c95 Mon Sep 17 00:00:00 2001
594167
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
594167
Date: Wed, 2 Mar 2022 17:19:56 +0100
594167
Subject: [PATCH] shared/install: drop unnecessary casts
594167
594167
The compiler coerces to bool for us, no need to do it explicitly.
594167
594167
(cherry picked from commit d3e85c9c81b1dd55eed2a33e8c25cef38db665f9)
594167
594167
Related: #2082131
594167
---
594167
 src/shared/install.c | 9 ++++-----
594167
 1 file changed, 4 insertions(+), 5 deletions(-)
594167
594167
diff --git a/src/shared/install.c b/src/shared/install.c
594167
index 459e8a6951..f1ee3c2716 100644
594167
--- a/src/shared/install.c
594167
+++ b/src/shared/install.c
594167
@@ -2178,7 +2178,7 @@ int unit_file_mask(
594167
                 if (!path)
594167
                         return -ENOMEM;
594167
 
594167
-                q = create_symlink(&lp, "/dev/null", path, !!(flags & UNIT_FILE_FORCE), changes, n_changes);
594167
+                q = create_symlink(&lp, "/dev/null", path, flags & UNIT_FILE_FORCE, changes, n_changes);
594167
                 if (q < 0 && r >= 0)
594167
                         r = q;
594167
         }
594167
@@ -2199,7 +2199,6 @@ int unit_file_unmask(
594167
         _cleanup_strv_free_ char **todo = NULL;
594167
         const char *config_path;
594167
         size_t n_todo = 0;
594167
-        bool dry_run;
594167
         char **i;
594167
         int r, q;
594167
 
594167
@@ -2214,7 +2213,7 @@ int unit_file_unmask(
594167
         if (!config_path)
594167
                 return -ENXIO;
594167
 
594167
-        dry_run = !!(flags & UNIT_FILE_DRY_RUN);
594167
+        bool dry_run = flags & UNIT_FILE_DRY_RUN;
594167
 
594167
         STRV_FOREACH(i, files) {
594167
                 _cleanup_free_ char *path = NULL;
594167
@@ -2354,7 +2353,7 @@ int unit_file_link(
594167
                 if (!new_path)
594167
                         return -ENOMEM;
594167
 
594167
-                q = create_symlink(&lp, *i, new_path, !!(flags & UNIT_FILE_FORCE), changes, n_changes);
594167
+                q = create_symlink(&lp, *i, new_path, flags & UNIT_FILE_FORCE, changes, n_changes);
594167
                 if (q < 0 && r >= 0)
594167
                         r = q;
594167
         }
594167
@@ -2689,7 +2688,7 @@ int unit_file_disable(
594167
         if (r < 0)
594167
                 return r;
594167
 
594167
-        return remove_marked_symlinks(remove_symlinks_to, config_path, &lp, !!(flags & UNIT_FILE_DRY_RUN), changes, n_changes);
594167
+        return remove_marked_symlinks(remove_symlinks_to, config_path, &lp, flags & UNIT_FILE_DRY_RUN, changes, n_changes);
594167
 }
594167
 
594167
 int unit_file_reenable(