libnm: pass around property_info instead of property_idx in NMSetting API

Various NMSetting API would accept a property_idx parameter. Together
with the NMSettInfoSetting instance, this was useful to find the actual
NMSettInfoProperty instance.

The idea was, to provide the most of the functionality. That is, if you
might need the property_idx too, you had it -- after all, the
property_info you could lookup yourself.

However,

- literally zero users care about the property_idx. The care about
  the property_info.

- if the user really, really required the property_idx, then it
  is a given that it can be easily computed by

     (property_info - sett_info->property_infos)
This commit is contained in:
Thomas Haller
2021-06-29 12:04:00 +02:00
parent b49a168935
commit d8292d462b
23 changed files with 282 additions and 284 deletions

View File

@@ -1315,19 +1315,19 @@ verify(NMSetting *setting, NMConnection *connection, GError **error)
}
static NMTernary
compare_property(const NMSettInfoSetting *sett_info,
guint property_idx,
NMConnection * con_a,
NMSetting * set_a,
NMConnection * con_b,
NMSetting * set_b,
NMSettingCompareFlags flags)
compare_property(const NMSettInfoSetting * sett_info,
const NMSettInfoProperty *property_info,
NMConnection * con_a,
NMSetting * set_a,
NMConnection * con_b,
NMSetting * set_b,
NMSettingCompareFlags flags)
{
NMSettingBridgePrivate *priv_a;
NMSettingBridgePrivate *priv_b;
guint i;
if (nm_streq(sett_info->property_infos[property_idx].name, NM_SETTING_BRIDGE_VLANS)) {
if (property_info->param_spec == obj_properties[PROP_VLANS]) {
if (set_b) {
priv_a = NM_SETTING_BRIDGE_GET_PRIVATE(set_a);
priv_b = NM_SETTING_BRIDGE_GET_PRIVATE(set_b);
@@ -1343,7 +1343,7 @@ compare_property(const NMSettInfoSetting *sett_info,
}
return NM_SETTING_CLASS(nm_setting_bridge_parent_class)
->compare_property(sett_info, property_idx, con_a, set_a, con_b, set_b, flags);
->compare_property(sett_info, property_info, con_a, set_a, con_b, set_b, flags);
}
/*****************************************************************************/