tree-wide: define iterator inside of the macro

This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2020-09-08 12:14:05 +02:00
parent 12375b95dd
commit 90e74a66e6
151 changed files with 543 additions and 924 deletions
+1 -2
View File
@@ -201,7 +201,6 @@ static int netdev_bond_fill_message_create(NetDev *netdev, Link *link, sd_netlin
}
if (b->arp_interval > 0 && !ordered_set_isempty(b->arp_ip_targets)) {
Iterator i;
void *val;
int n = 0;
@@ -209,7 +208,7 @@ static int netdev_bond_fill_message_create(NetDev *netdev, Link *link, sd_netlin
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not open contaniner IFLA_BOND_ARP_IP_TARGET : %m");
ORDERED_SET_FOREACH(val, b->arp_ip_targets, i) {
ORDERED_SET_FOREACH(val, b->arp_ip_targets) {
r = sd_netlink_message_append_u32(m, n++, PTR_TO_UINT32(val));
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_BOND_ARP_ALL_TARGETS attribute: %m");
+4 -7
View File
@@ -275,7 +275,6 @@ static int l2tp_acquire_local_address_one(L2tpTunnel *t, Address *a, union in_ad
static int l2tp_acquire_local_address(L2tpTunnel *t, Link *link, union in_addr_union *ret) {
Address *a;
Iterator i;
assert(t);
assert(link);
@@ -288,11 +287,11 @@ static int l2tp_acquire_local_address(L2tpTunnel *t, Link *link, union in_addr_u
return 0;
}
SET_FOREACH(a, link->addresses, i)
SET_FOREACH(a, link->addresses)
if (l2tp_acquire_local_address_one(t, a, ret) >= 0)
return 1;
SET_FOREACH(a, link->addresses_foreign, i)
SET_FOREACH(a, link->addresses_foreign)
if (l2tp_acquire_local_address_one(t, a, ret) >= 0)
return 1;
@@ -348,7 +347,6 @@ static int l2tp_create_session(NetDev *netdev, L2tpSession *session) {
static int l2tp_create_tunnel_handler(sd_netlink *rtnl, sd_netlink_message *m, NetDev *netdev) {
L2tpSession *session;
L2tpTunnel *t;
Iterator i;
int r;
assert(netdev);
@@ -370,7 +368,7 @@ static int l2tp_create_tunnel_handler(sd_netlink *rtnl, sd_netlink_message *m, N
log_netdev_debug(netdev, "L2TP tunnel is created");
ORDERED_HASHMAP_FOREACH(session, t->sessions_by_section, i)
ORDERED_HASHMAP_FOREACH(session, t->sessions_by_section)
(void) l2tp_create_session(netdev, session);
return 1;
@@ -677,7 +675,6 @@ static int l2tp_session_verify(L2tpSession *session) {
static int netdev_l2tp_tunnel_verify(NetDev *netdev, const char *filename) {
L2tpTunnel *t;
L2tpSession *session;
Iterator i;
assert(netdev);
assert(filename);
@@ -701,7 +698,7 @@ static int netdev_l2tp_tunnel_verify(NetDev *netdev, const char *filename) {
"%s: L2TP tunnel without tunnel IDs configured. Ignoring",
filename);
ORDERED_HASHMAP_FOREACH(session, t->sessions_by_section, i)
ORDERED_HASHMAP_FOREACH(session, t->sessions_by_section)
if (l2tp_session_verify(session) < 0)
l2tp_session_free(session);
+5 -7
View File
@@ -494,7 +494,6 @@ static int netdev_macsec_configure_transmit_association(NetDev *netdev, Transmit
static int netdev_macsec_configure(NetDev *netdev, Link *link, sd_netlink_message *m) {
TransmitAssociation *a;
ReceiveChannel *c;
Iterator i;
MACsec *s;
int r;
@@ -502,13 +501,13 @@ static int netdev_macsec_configure(NetDev *netdev, Link *link, sd_netlink_messag
s = MACSEC(netdev);
assert(s);
ORDERED_HASHMAP_FOREACH(a, s->transmit_associations_by_section, i) {
ORDERED_HASHMAP_FOREACH(a, s->transmit_associations_by_section) {
r = netdev_macsec_configure_transmit_association(netdev, a);
if (r < 0)
return r;
}
ORDERED_HASHMAP_FOREACH(c, s->receive_channels, i) {
ORDERED_HASHMAP_FOREACH(c, s->receive_channels) {
r = netdev_macsec_configure_receive_channel(netdev, c);
if (r < 0)
return r;
@@ -1148,7 +1147,6 @@ static int netdev_macsec_verify(NetDev *netdev, const char *filename) {
TransmitAssociation *a;
ReceiveAssociation *n;
ReceiveChannel *c;
Iterator i;
uint8_t an, encoding_an;
bool use_for_encoding;
int r;
@@ -1157,7 +1155,7 @@ static int netdev_macsec_verify(NetDev *netdev, const char *filename) {
assert(v);
assert(filename);
ORDERED_HASHMAP_FOREACH(c, v->receive_channels_by_section, i) {
ORDERED_HASHMAP_FOREACH(c, v->receive_channels_by_section) {
r = macsec_receive_channel_verify(c);
if (r < 0)
macsec_receive_channel_free(c);
@@ -1166,7 +1164,7 @@ static int netdev_macsec_verify(NetDev *netdev, const char *filename) {
an = 0;
use_for_encoding = false;
encoding_an = 0;
ORDERED_HASHMAP_FOREACH(a, v->transmit_associations_by_section, i) {
ORDERED_HASHMAP_FOREACH(a, v->transmit_associations_by_section) {
r = macsec_transmit_association_verify(a);
if (r < 0) {
macsec_transmit_association_free(a);
@@ -1201,7 +1199,7 @@ static int netdev_macsec_verify(NetDev *netdev, const char *filename) {
assert(encoding_an < MACSEC_MAX_ASSOCIATION_NUMBER);
v->encoding_an = encoding_an;
ORDERED_HASHMAP_FOREACH(n, v->receive_associations_by_section, i) {
ORDERED_HASHMAP_FOREACH(n, v->receive_associations_by_section) {
r = macsec_receive_association_verify(n);
if (r < 0)
macsec_receive_association_free(n);
+1 -2
View File
@@ -24,7 +24,6 @@ static int netdev_macvlan_fill_message_create(NetDev *netdev, Link *link, sd_net
assert(m);
if (m->mode == NETDEV_MACVLAN_MODE_SOURCE && !set_isempty(m->match_source_mac)) {
Iterator i;
const struct ether_addr *mac_addr;
r = sd_netlink_message_append_u32(req, IFLA_MACVLAN_MACADDR_MODE, MACVLAN_MACADDR_SET);
@@ -35,7 +34,7 @@ static int netdev_macvlan_fill_message_create(NetDev *netdev, Link *link, sd_net
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not open IFLA_MACVLAN_MACADDR_DATA container: %m");
SET_FOREACH(mac_addr, m->match_source_mac, i) {
SET_FOREACH(mac_addr, m->match_source_mac) {
r = sd_netlink_message_append_ether_addr(req, IFLA_MACVLAN_MACADDR, mac_addr);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_MACVLAN_MACADDR attribute: %m");
+1 -2
View File
@@ -395,14 +395,13 @@ static void resolve_endpoints(NetDev *netdev) {
};
WireguardPeer *peer;
Wireguard *w;
Iterator i;
int r;
assert(netdev);
w = WIREGUARD(netdev);
assert(w);
SET_FOREACH(peer, w->peers_with_unresolved_endpoint, i) {
SET_FOREACH(peer, w->peers_with_unresolved_endpoint) {
r = resolve_getaddrinfo(netdev->manager->resolve,
NULL,
peer->endpoint_host,