core: return new object from _nm_ip_config_add_obj()

Will be used later.
This commit is contained in:
Thomas Haller 2017-08-30 19:05:38 +02:00
parent 546e12417a
commit a0ca607080
3 changed files with 33 additions and 15 deletions

View file

@ -165,10 +165,12 @@ _nm_ip_config_add_obj (NMDedupMultiIndex *multi_idx,
const NMPObject *obj_new,
const NMPlatformObject *pl_new,
gboolean merge,
gboolean append_force)
gboolean append_force,
const NMPObject **out_obj_new)
{
NMPObject obj_new_stackinit;
const NMDedupMultiEntry *entry_old;
const NMDedupMultiEntry *entry_new;
nm_assert (multi_idx);
nm_assert (idx_type);
@ -271,15 +273,18 @@ _nm_ip_config_add_obj (NMDedupMultiIndex *multi_idx,
NULL,
entry_old ?: NM_DEDUP_MULTI_ENTRY_MISSING,
NULL,
NULL,
&entry_new,
NULL)) {
nm_assert_not_reached ();
NM_SET_OUT (out_obj_new, NULL);
return FALSE;
}
NM_SET_OUT (out_obj_new, entry_new->obj);
return TRUE;
append_force_and_out:
NM_SET_OUT (out_obj_new, entry_old->obj);
if (append_force) {
if (nm_dedup_multi_entry_reorder (entry_old, NULL, TRUE))
return TRUE;
@ -641,7 +646,8 @@ nm_ip4_config_capture (NMDedupMultiIndex *multi_idx, NMPlatform *platform, int i
plobj,
NULL,
FALSE,
TRUE))
TRUE,
NULL))
nm_assert_not_reached ();
}
head_entry = nm_ip4_config_lookup_addresses (self);
@ -1580,7 +1586,8 @@ nm_ip4_config_replace (NMIP4Config *dst, const NMIP4Config *src, gboolean *relev
ipconf_iter_src.current->obj,
NULL,
FALSE,
TRUE);
TRUE,
NULL);
}
nm_dedup_multi_index_dirty_remove_idx (dst_priv->multi_idx, &dst_priv->idx_ip4_addresses, FALSE);
_notify_addresses (dst);
@ -1625,7 +1632,8 @@ nm_ip4_config_replace (NMIP4Config *dst, const NMIP4Config *src, gboolean *relev
ipconf_iter_src.current->obj,
NULL,
FALSE,
TRUE);
TRUE,
NULL);
}
nm_dedup_multi_index_dirty_remove_idx (dst_priv->multi_idx, &dst_priv->idx_ip4_routes, FALSE);
_notify_routes (dst);
@ -1986,7 +1994,8 @@ _add_address (NMIP4Config *self, const NMPObject *obj_new, const NMPlatformIP4Ad
obj_new,
(const NMPlatformObject *) new,
TRUE,
FALSE))
FALSE,
NULL))
_notify_addresses (self);
}
@ -2126,7 +2135,8 @@ _add_route (NMIP4Config *self, const NMPObject *obj_new, const NMPlatformIP4Rout
obj_new,
(const NMPlatformObject *) new,
TRUE,
FALSE))
FALSE,
NULL))
_notify_routes (self);
}

View file

@ -90,7 +90,8 @@ gboolean _nm_ip_config_add_obj (NMDedupMultiIndex *multi_idx,
const NMPObject *obj_new,
const NMPlatformObject *pl_new,
gboolean merge,
gboolean append_force);
gboolean append_force,
const NMPObject **out_obj_new);
const NMDedupMultiEntry *_nm_ip_config_lookup_ip_route (const NMDedupMultiIndex *multi_idx,
const NMIPConfigDedupMultiIdxType *idx_type,

View file

@ -439,7 +439,8 @@ nm_ip6_config_capture (NMDedupMultiIndex *multi_idx, NMPlatform *platform, int i
plobj,
NULL,
FALSE,
TRUE))
TRUE,
NULL))
nm_assert_not_reached ();
has_addresses = TRUE;
}
@ -1254,7 +1255,8 @@ nm_ip6_config_replace (NMIP6Config *dst, const NMIP6Config *src, gboolean *relev
ipconf_iter_src.current->obj,
NULL,
FALSE,
TRUE);
TRUE,
NULL);
}
nm_dedup_multi_index_dirty_remove_idx (dst_priv->multi_idx, &dst_priv->idx_ip6_addresses, FALSE);
_notify_addresses (dst);
@ -1299,7 +1301,8 @@ nm_ip6_config_replace (NMIP6Config *dst, const NMIP6Config *src, gboolean *relev
ipconf_iter_src.current->obj,
NULL,
FALSE,
TRUE);
TRUE,
NULL);
}
nm_dedup_multi_index_dirty_remove_idx (dst_priv->multi_idx, &dst_priv->idx_ip6_routes, FALSE);
_notify_routes (dst);
@ -1561,7 +1564,8 @@ nm_ip6_config_reset_addresses_ndisc (NMIP6Config *self,
&obj,
NULL,
FALSE,
TRUE))
TRUE,
NULL))
changed = TRUE;
}
@ -1595,7 +1599,8 @@ _add_address (NMIP6Config *self,
obj_new,
(const NMPlatformObject *) new,
TRUE,
FALSE))
FALSE,
NULL))
_notify_addresses (self);
}
@ -1788,7 +1793,8 @@ nm_ip6_config_reset_routes_ndisc (NMIP6Config *self,
&obj,
NULL,
FALSE,
TRUE))
TRUE,
NULL))
changed = TRUE;
}
@ -1824,7 +1830,8 @@ _add_route (NMIP6Config *self, const NMPObject *obj_new, const NMPlatformIP6Rout
obj_new,
(const NMPlatformObject *) new,
TRUE,
FALSE))
FALSE,
NULL))
_notify_routes (self);
}