dryang / rpms / systemd

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