Skip to content

Commit ab8ee0f

Browse files
keszybzpoettering
authored andcommitted
tree-wide: use SET_FLAG in more places (systemd#5892)
1 parent f7bf1ab commit ab8ee0f

File tree

4 files changed

+6
-18
lines changed

4 files changed

+6
-18
lines changed

src/network/netdev/vlan.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,7 @@ static int netdev_vlan_fill_message_create(NetDev *netdev, Link *link, sd_netlin
4242

4343
if (v->gvrp != -1) {
4444
flags.mask |= VLAN_FLAG_GVRP;
45-
46-
if (v->gvrp)
47-
flags.flags |= VLAN_FLAG_GVRP;
48-
else
49-
flags.flags &= ~VLAN_FLAG_GVRP;
45+
SET_FLAG(flags.flags, VLAN_FLAG_GVRP, v->gvrp);
5046
}
5147

5248
r = sd_netlink_message_append_data(req, IFLA_VLAN_FLAGS, &flags, sizeof(struct ifla_vlan_flags));

src/network/networkd-route.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -973,10 +973,7 @@ int config_parse_gateway_onlink(const char *unit,
973973
return 0;
974974
}
975975

976-
if (r)
977-
n->flags |= RTNH_F_ONLINK;
978-
else
979-
n->flags &= ~RTNH_F_ONLINK;
976+
SET_FLAG(n->flags, RTNH_F_ONLINK, r);
980977
n = NULL;
981978

982979
return 0;

src/nspawn/nspawn.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -389,12 +389,10 @@ static void parse_mount_settings_env(void) {
389389
if (r < 0) {
390390
log_warning_errno(r, "Failed to parse SYSTEMD_NSPAWN_API_VFS_WRITABLE from environment, ignoring.");
391391
return;
392-
} else if (r > 0)
393-
arg_mount_settings &= ~MOUNT_APPLY_APIVFS_RO;
394-
else
395-
arg_mount_settings |= MOUNT_APPLY_APIVFS_RO;
392+
}
396393

397-
arg_mount_settings &= ~MOUNT_APPLY_APIVFS_NETNS;
394+
SET_FLAG(arg_mount_settings, MOUNT_APPLY_APIVFS_RO, r == 0);
395+
SET_FLAG(arg_mount_settings, MOUNT_APPLY_APIVFS_NETNS, false);
398396
}
399397

400398
static int parse_argv(int argc, char *argv[]) {

src/vconsole/vconsole-setup.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,7 @@ static int toggle_utf8(const char *name, int fd, bool utf8) {
9999

100100
r = tcgetattr(fd, &tc);
101101
if (r >= 0) {
102-
if (utf8)
103-
tc.c_iflag |= IUTF8;
104-
else
105-
tc.c_iflag &= ~IUTF8;
102+
SET_FLAG(tc.c_iflag, IUTF8, utf8);
106103
r = tcsetattr(fd, TCSANOW, &tc);
107104
}
108105
if (r < 0)

0 commit comments

Comments
 (0)