tree-wide: use SET_FLAG in more places (#5892)
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sun, 7 May 2017 11:03:28 +0000 (07:03 -0400)
committerLennart Poettering <lennart@poettering.net>
Sun, 7 May 2017 11:03:28 +0000 (07:03 -0400)
src/network/netdev/vlan.c
src/network/networkd-route.c
src/nspawn/nspawn.c
src/vconsole/vconsole-setup.c

index 718b627..60d6343 100644 (file)
@@ -42,11 +42,7 @@ static int netdev_vlan_fill_message_create(NetDev *netdev, Link *link, sd_netlin
 
         if (v->gvrp != -1) {
                 flags.mask |= VLAN_FLAG_GVRP;
-
-                if (v->gvrp)
-                        flags.flags |= VLAN_FLAG_GVRP;
-                else
-                        flags.flags &= ~VLAN_FLAG_GVRP;
+                SET_FLAG(flags.flags, VLAN_FLAG_GVRP, v->gvrp);
         }
 
         r = sd_netlink_message_append_data(req, IFLA_VLAN_FLAGS, &flags, sizeof(struct ifla_vlan_flags));
index 94204bd..ff93fe4 100644 (file)
@@ -973,10 +973,7 @@ int config_parse_gateway_onlink(const char *unit,
                 return 0;
         }
 
-        if (r)
-                n->flags |= RTNH_F_ONLINK;
-        else
-                n->flags &= ~RTNH_F_ONLINK;
+        SET_FLAG(n->flags, RTNH_F_ONLINK, r);
         n = NULL;
 
         return 0;
index 905dbc4..a21fc1b 100644 (file)
@@ -389,12 +389,10 @@ static void parse_mount_settings_env(void) {
         if (r < 0) {
                 log_warning_errno(r, "Failed to parse SYSTEMD_NSPAWN_API_VFS_WRITABLE from environment, ignoring.");
                 return;
-        } else if (r > 0)
-                arg_mount_settings &= ~MOUNT_APPLY_APIVFS_RO;
-        else
-                arg_mount_settings |= MOUNT_APPLY_APIVFS_RO;
+        }
 
-        arg_mount_settings &= ~MOUNT_APPLY_APIVFS_NETNS;
+        SET_FLAG(arg_mount_settings, MOUNT_APPLY_APIVFS_RO, r == 0);
+        SET_FLAG(arg_mount_settings, MOUNT_APPLY_APIVFS_NETNS, false);
 }
 
 static int parse_argv(int argc, char *argv[]) {
index a0ab599..36d04d4 100644 (file)
@@ -99,10 +99,7 @@ static int toggle_utf8(const char *name, int fd, bool utf8) {
 
         r = tcgetattr(fd, &tc);
         if (r >= 0) {
-                if (utf8)
-                        tc.c_iflag |= IUTF8;
-                else
-                        tc.c_iflag &= ~IUTF8;
+                SET_FLAG(tc.c_iflag, IUTF8, utf8);
                 r = tcsetattr(fd, TCSANOW, &tc);
         }
         if (r < 0)