mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-02 16:38:15 +02:00
libnm: special handle "name" properties compare_fcn
All settings have a "name" property. Their compare_fcn() is not interesting and was already previously ignored. But we should not special handle it via _nm_setting_property_compare_fcn_default().
This commit is contained in:
parent
c7262c2290
commit
33bd052a87
2 changed files with 14 additions and 8 deletions
|
|
@ -389,11 +389,17 @@ _nm_setting_class_commit(NMSettingClass * setting_class,
|
|||
p->property_type = NM_SETT_INFO_PROPERT_TYPE_GPROP(
|
||||
G_VARIANT_TYPE_UINT64,
|
||||
.compare_fcn = _nm_setting_property_compare_fcn_default);
|
||||
else if (vtype == G_TYPE_STRING)
|
||||
p->property_type = NM_SETT_INFO_PROPERT_TYPE_GPROP(
|
||||
G_VARIANT_TYPE_STRING,
|
||||
.compare_fcn = _nm_setting_property_compare_fcn_default);
|
||||
else if (vtype == G_TYPE_DOUBLE)
|
||||
else if (vtype == G_TYPE_STRING) {
|
||||
if (nm_streq(p->name, NM_SETTING_NAME)) {
|
||||
p->property_type = NM_SETT_INFO_PROPERT_TYPE_GPROP(
|
||||
G_VARIANT_TYPE_STRING,
|
||||
.compare_fcn = _nm_setting_property_compare_fcn_ignore);
|
||||
} else {
|
||||
p->property_type = NM_SETT_INFO_PROPERT_TYPE_GPROP(
|
||||
G_VARIANT_TYPE_STRING,
|
||||
.compare_fcn = _nm_setting_property_compare_fcn_default);
|
||||
}
|
||||
} else if (vtype == G_TYPE_DOUBLE)
|
||||
p->property_type = NM_SETT_INFO_PROPERT_TYPE_GPROP(
|
||||
G_VARIANT_TYPE_DOUBLE,
|
||||
.compare_fcn = _nm_setting_property_compare_fcn_default);
|
||||
|
|
@ -1756,9 +1762,6 @@ _nm_setting_property_compare_fcn_default(const NMSettInfoSetting * sett_info,
|
|||
&& NM_FLAGS_HAS(param_spec->flags, NM_SETTING_PARAM_SECRET))
|
||||
return NM_TERNARY_DEFAULT;
|
||||
|
||||
if (nm_streq(param_spec->name, NM_SETTING_NAME))
|
||||
return NM_TERNARY_DEFAULT;
|
||||
|
||||
if (NM_FLAGS_HAS(param_spec->flags, NM_SETTING_PARAM_SECRET)
|
||||
&& !_nm_setting_should_compare_secret_property(set_a, set_b, param_spec->name, flags))
|
||||
return NM_TERNARY_DEFAULT;
|
||||
|
|
|
|||
|
|
@ -4526,6 +4526,7 @@ check_done:;
|
|||
|
||||
if (sip->property_type->compare_fcn == _nm_setting_property_compare_fcn_default) {
|
||||
g_assert(sip->param_spec);
|
||||
g_assert_cmpstr(sip->name, !=, NM_SETTING_NAME);
|
||||
} else if (sip->property_type->compare_fcn == _nm_setting_property_compare_fcn_ignore) {
|
||||
if (NM_IN_SET(sip->property_type,
|
||||
&nm_sett_info_propert_type_deprecated_ignore_i,
|
||||
|
|
@ -4534,6 +4535,8 @@ check_done:;
|
|||
/* pass */
|
||||
} else if (!sip->param_spec) {
|
||||
/* pass */
|
||||
} else if (nm_streq(sip->name, NM_SETTING_NAME)) {
|
||||
/* pass */
|
||||
} else {
|
||||
/* ignoring a property for comparison make only sense in very specific cases. */
|
||||
g_assert_not_reached();
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue