dryang / rpms / systemd

Forked from rpms/systemd a year ago
Clone
Blob Blame History Raw
From 34c379b77a4bfacb675cb6e5a363317d7dcc9c95 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Wed, 2 Mar 2022 17:19:56 +0100
Subject: [PATCH] shared/install: drop unnecessary casts

The compiler coerces to bool for us, no need to do it explicitly.

(cherry picked from commit d3e85c9c81b1dd55eed2a33e8c25cef38db665f9)

Related: #2082131
---
 src/shared/install.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/src/shared/install.c b/src/shared/install.c
index 459e8a6951..f1ee3c2716 100644
--- a/src/shared/install.c
+++ b/src/shared/install.c
@@ -2178,7 +2178,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;
         }
@@ -2199,7 +2199,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;
 
@@ -2214,7 +2213,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;
@@ -2354,7 +2353,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;
         }
@@ -2689,7 +2688,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(