mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager
synced 2024-07-25 04:04:36 +00:00
l3cfg: change l3cd for-each macros to take pointers instead of variable names
It's not a big difference and unclear which is preferable. It however seems slighly clearer to require the user to provide a pointer, instead of a variable for which the macro itself takes the reference. It makes it clearer that the "iter" and "obj" arguments are modified by the macro.
This commit is contained in:
parent
6bf5f014c8
commit
d2beefa658
|
@ -1339,7 +1339,7 @@ _data_get_direct_route_for_host (const NML3ConfigData *self,
|
|||
if (nm_ip_addr_is_null (addr_family, host))
|
||||
return NULL;
|
||||
|
||||
nm_l3_config_data_iter_obj_for_each (ipconf_iter, self, item_obj, NMP_OBJECT_TYPE_IP_ROUTE (IS_IPv4)) {
|
||||
nm_l3_config_data_iter_obj_for_each (&ipconf_iter, self, &item_obj, NMP_OBJECT_TYPE_IP_ROUTE (IS_IPv4)) {
|
||||
const NMPlatformIPXRoute *item = NMP_OBJECT_CAST_IPX_ROUTE (item_obj);
|
||||
|
||||
if (nm_ip_addr_is_null (addr_family,
|
||||
|
@ -1406,7 +1406,7 @@ nm_l3_config_data_add_dependent_routes (NML3ConfigData *self,
|
|||
nm_l3_config_data_add_route (self, addr_family, NULL, &rx.rx);
|
||||
}
|
||||
|
||||
nm_l3_config_data_iter_obj_for_each (iter, self, my_addr_obj, NMP_OBJECT_TYPE_IP_ADDRESS (IS_IPv4)) {
|
||||
nm_l3_config_data_iter_obj_for_each (&iter, self, &my_addr_obj, NMP_OBJECT_TYPE_IP_ADDRESS (IS_IPv4)) {
|
||||
const NMPlatformIPXAddress *const my_addr = NMP_OBJECT_CAST_IPX_ADDRESS (my_addr_obj);
|
||||
|
||||
if (my_addr->ax.external)
|
||||
|
@ -1541,7 +1541,7 @@ nm_l3_config_data_add_dependent_routes (NML3ConfigData *self,
|
|||
}
|
||||
}
|
||||
|
||||
nm_l3_config_data_iter_obj_for_each (iter, self, my_route_obj, NMP_OBJECT_TYPE_IP_ROUTE (IS_IPv4)) {
|
||||
nm_l3_config_data_iter_obj_for_each (&iter, self, &my_route_obj, NMP_OBJECT_TYPE_IP_ROUTE (IS_IPv4)) {
|
||||
const NMPlatformIPXRoute *my_route = NMP_OBJECT_CAST_IPX_ROUTE (my_route_obj);
|
||||
NMPObject *new_route;
|
||||
NMPlatformIPXRoute *new_r;
|
||||
|
@ -1913,9 +1913,9 @@ nm_l3_config_data_merge (NML3ConfigData *self,
|
|||
const int addr_family = IS_IPv4 ? AF_INET : AF_INET6;
|
||||
const NML3ConfigDatFlags has_dns_priority_flag = NM_L3_CONFIG_DAT_FLAGS_HAS_DNS_PRIORITY (IS_IPv4);
|
||||
|
||||
nm_l3_config_data_iter_obj_for_each (iter,
|
||||
nm_l3_config_data_iter_obj_for_each (&iter,
|
||||
src,
|
||||
obj,
|
||||
&obj,
|
||||
NMP_OBJECT_TYPE_IP_ADDRESS (IS_IPv4)) {
|
||||
|
||||
if ( hook_add_addr
|
||||
|
@ -1950,9 +1950,9 @@ nm_l3_config_data_merge (NML3ConfigData *self,
|
|||
}
|
||||
|
||||
if (!NM_FLAGS_HAS (merge_flags, NM_L3_CONFIG_MERGE_FLAGS_NO_ROUTES)) {
|
||||
nm_l3_config_data_iter_obj_for_each (iter,
|
||||
nm_l3_config_data_iter_obj_for_each (&iter,
|
||||
src,
|
||||
obj,
|
||||
&obj,
|
||||
NMP_OBJECT_TYPE_IP_ROUTE (IS_IPv4)) {
|
||||
if (NM_PLATFORM_IP_ROUTE_IS_DEFAULT (NMP_OBJECT_CAST_IP_ROUTE (obj))) {
|
||||
if ( NM_FLAGS_HAS (merge_flags, NM_L3_CONFIG_MERGE_FLAGS_NO_DEFAULT_ROUTES)
|
||||
|
|
|
@ -181,28 +181,28 @@ nm_l3_config_data_lookup_routes (const NML3ConfigData *self, int addr_family)
|
|||
}
|
||||
|
||||
#define nm_l3_config_data_iter_obj_for_each(iter, self, obj, type) \
|
||||
for (nm_dedup_multi_iter_init (&(iter), nm_l3_config_data_lookup_objs ((self), (type))); \
|
||||
nm_platform_dedup_multi_iter_next_obj (&(iter), &(obj), (type)); \
|
||||
for (nm_dedup_multi_iter_init ((iter), nm_l3_config_data_lookup_objs ((self), (type))); \
|
||||
nm_platform_dedup_multi_iter_next_obj ((iter), (obj), (type)); \
|
||||
)
|
||||
|
||||
#define nm_l3_config_data_iter_ip4_address_for_each(iter, self, address) \
|
||||
for (nm_dedup_multi_iter_init (&(iter), nm_l3_config_data_lookup_addresses ((self), AF_INET)); \
|
||||
nm_platform_dedup_multi_iter_next_ip4_address (&(iter), &(address)); \
|
||||
for (nm_dedup_multi_iter_init ((iter), nm_l3_config_data_lookup_addresses ((self), AF_INET)); \
|
||||
nm_platform_dedup_multi_iter_next_ip4_address ((iter), (address)); \
|
||||
)
|
||||
|
||||
#define nm_l3_config_data_iter_ip6_address_for_each(iter, self, address) \
|
||||
for (nm_dedup_multi_iter_init (&(iter), nm_l3_config_data_lookup_addresses ((self), AF_INET6)); \
|
||||
nm_platform_dedup_multi_iter_next_ip6_address (&(iter), &(address)); \
|
||||
for (nm_dedup_multi_iter_init ((iter), nm_l3_config_data_lookup_addresses ((self), AF_INET6)); \
|
||||
nm_platform_dedup_multi_iter_next_ip6_address ((iter), (address)); \
|
||||
)
|
||||
|
||||
#define nm_l3_config_data_iter_ip4_route_for_each(iter, self, route) \
|
||||
for (nm_dedup_multi_iter_init (&(iter), nm_l3_config_data_lookup_routes ((self), AF_INET)); \
|
||||
nm_platform_dedup_multi_iter_next_ip4_route (&(iter), &(route)); \
|
||||
for (nm_dedup_multi_iter_init ((iter), nm_l3_config_data_lookup_routes ((self), AF_INET)); \
|
||||
nm_platform_dedup_multi_iter_next_ip4_route ((iter), (route)); \
|
||||
)
|
||||
|
||||
#define nm_l3_config_data_iter_ip6_route_for_each(iter, self, route) \
|
||||
for (nm_dedup_multi_iter_init (&(iter), nm_l3_config_data_lookup_routes ((self), AF_INET6)); \
|
||||
nm_platform_dedup_multi_iter_next_ip6_route (&(iter), &(route)); \
|
||||
for (nm_dedup_multi_iter_init ((iter), nm_l3_config_data_lookup_routes ((self), AF_INET6)); \
|
||||
nm_platform_dedup_multi_iter_next_ip6_route ((iter), (route)); \
|
||||
)
|
||||
|
||||
static inline guint
|
||||
|
|
|
@ -279,13 +279,13 @@ _l3cfg_externally_removed_objs_pickup (NML3Cfg *self,
|
|||
if (!self->priv.p->combined_l3cd)
|
||||
return;
|
||||
|
||||
nm_l3_config_data_iter_obj_for_each (iter, self->priv.p->combined_l3cd, obj, NMP_OBJECT_TYPE_IP_ADDRESS (IS_IPv4)) {
|
||||
nm_l3_config_data_iter_obj_for_each (&iter, self->priv.p->combined_l3cd, &obj, NMP_OBJECT_TYPE_IP_ADDRESS (IS_IPv4)) {
|
||||
if (!nm_platform_lookup_entry (self->priv.platform,
|
||||
NMP_CACHE_ID_TYPE_OBJECT_TYPE,
|
||||
obj))
|
||||
_l3cfg_externally_removed_objs_track (self, obj, TRUE);
|
||||
}
|
||||
nm_l3_config_data_iter_obj_for_each (iter, self->priv.p->combined_l3cd, obj, NMP_OBJECT_TYPE_IP_ROUTE (IS_IPv4)) {
|
||||
nm_l3_config_data_iter_obj_for_each (&iter, self->priv.p->combined_l3cd, &obj, NMP_OBJECT_TYPE_IP_ROUTE (IS_IPv4)) {
|
||||
if (!nm_platform_lookup_entry (self->priv.platform,
|
||||
NMP_CACHE_ID_TYPE_OBJECT_TYPE,
|
||||
obj))
|
||||
|
|
Loading…
Reference in a new issue