From: Jo-Philipp Wich Date: Tue, 19 Feb 2013 18:07:13 +0000 (+0100) Subject: convert remaining occurences to hasbit() / setbit() helper macros X-Git-Url: http://git.archive.openwrt.org/?p=project%2Ffirewall3.git;a=commitdiff_plain;h=5a88c9e5130fba8a1ef3f68265493e56ba650abb convert remaining occurences to hasbit() / setbit() helper macros --- diff --git a/defaults.c b/defaults.c index 886da2f..d59c5bf 100644 --- a/defaults.c +++ b/defaults.c @@ -101,7 +101,7 @@ print_chains(enum fw3_table table, enum fw3_family family, if (c->table != table) continue; - if ((c->flag != FW3_DEFAULT_UNSPEC) && !(flags & (1 << c->flag))) + if ((c->flag != FW3_DEFAULT_UNSPEC) && !hasbit(flags, c->flag)) continue; fw3_pr(fmt, c->name); @@ -142,7 +142,7 @@ fw3_load_defaults(struct fw3_state *state, struct uci_package *p) defs->tcp_window_scaling = true; defs->custom_chains = true; - defs->flags = (1 << FW3_DEFAULT_IPV4_LOADED); + setbit(defs->flags, FW3_DEFAULT_IPV4_LOADED); uci_foreach_element(&p->sections, e) { diff --git a/zones.c b/zones.c index 584ebca..3195a32 100644 --- a/zones.c +++ b/zones.c @@ -96,7 +96,7 @@ print_chains(enum fw3_table table, enum fw3_family family, if (c->table != table) continue; - if ((c->target != FW3_TARGET_UNSPEC) && !(targets & (1 << c->target))) + if ((c->target != FW3_TARGET_UNSPEC) && !hasbit(targets, c->target)) continue; snprintf(cn, sizeof(cn), c->name, name); @@ -253,7 +253,7 @@ print_interface_rule(enum fw3_table table, enum fw3_family family, { for (t = FW3_TARGET_ACCEPT; t <= FW3_TARGET_DROP; t++) { - if (zone->src_flags & (1 << t)) + if (hasbit(zone->src_flags, t)) { fw3_pr("-A zone_%s_src_%s", zone->name, targets[t*2]); fw3_format_in_out(dev, NULL); @@ -262,7 +262,7 @@ print_interface_rule(enum fw3_table table, enum fw3_family family, fw3_pr(" -j %s\n", targets[t*2+1]); } - if (zone->dst_flags & (1 << t)) + if (hasbit(zone->dst_flags, t)) { fw3_pr("-A zone_%s_dest_%s", zone->name, targets[t*2]); fw3_format_in_out(NULL, dev); @@ -292,7 +292,7 @@ print_interface_rule(enum fw3_table table, enum fw3_family family, } else if (table == FW3_TABLE_NAT) { - if (zone->dst_flags & (1 << FW3_TARGET_DNAT)) + if (hasbit(zone->dst_flags, FW3_TARGET_DNAT)) { fw3_pr("-A delegate_prerouting"); fw3_format_in_out(dev, NULL); @@ -301,7 +301,7 @@ print_interface_rule(enum fw3_table table, enum fw3_family family, fw3_pr(" -j zone_%s_prerouting\n", zone->name); } - if (zone->dst_flags & (1 << FW3_TARGET_SNAT)) + if (hasbit(zone->dst_flags, FW3_TARGET_SNAT)) { fw3_pr("-A delegate_postrouting"); fw3_format_in_out(NULL, dev); @@ -404,7 +404,7 @@ print_zone_rule(enum fw3_table table, enum fw3_family family, { for (t = FW3_TARGET_REJECT; t <= FW3_TARGET_DROP; t++) { - if (zone->src_flags & (1 << t)) + if (hasbit(zone->src_flags, t)) { fw3_pr("-A zone_%s_src_%s", zone->name, targets[t]); fw3_format_limit(&zone->log_limit); @@ -412,7 +412,7 @@ print_zone_rule(enum fw3_table table, enum fw3_family family, targets[t], zone->name); } - if (zone->dst_flags & (1 << t)) + if (hasbit(zone->dst_flags, t)) { fw3_pr("-A zone_%s_dest_%s", zone->name, targets[t]); fw3_format_limit(&zone->log_limit);