mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-14 06:20:37 +01:00
libnm: add and use _nm_setting_get_private_field() helper
All callers of _nm_setting_get_private() got the offset from the property info. Add a wrapper _nm_setting_get_private_field() that takes the property info. This way, it can add some assertions.
This commit is contained in:
parent
68b6aa64fd
commit
87ca5875d0
2 changed files with 75 additions and 87 deletions
|
|
@ -650,7 +650,7 @@ _property_direct_set_string(const NMSettInfoSetting *sett_info,
|
|||
return property_info->direct_hook.set_string_fcn(sett_info, property_info, setting, src);
|
||||
}
|
||||
|
||||
dst = _nm_setting_get_private(setting, sett_info, property_info->direct_offset);
|
||||
dst = _nm_setting_get_private_field(setting, sett_info, property_info);
|
||||
|
||||
if (property_info->direct_string_is_refstr) {
|
||||
nm_assert(property_info->param_spec);
|
||||
|
|
@ -712,64 +712,56 @@ _nm_setting_property_get_property_direct(GObject *object,
|
|||
switch (property_info->property_type->direct_type) {
|
||||
case NM_VALUE_TYPE_BOOL:
|
||||
{
|
||||
const bool *p_val =
|
||||
_nm_setting_get_private(setting, sett_info, property_info->direct_offset);
|
||||
const bool *p_val = _nm_setting_get_private_field(setting, sett_info, property_info);
|
||||
|
||||
g_value_set_boolean(value, *p_val);
|
||||
return;
|
||||
}
|
||||
case NM_VALUE_TYPE_INT32:
|
||||
{
|
||||
const gint32 *p_val =
|
||||
_nm_setting_get_private(setting, sett_info, property_info->direct_offset);
|
||||
const gint32 *p_val = _nm_setting_get_private_field(setting, sett_info, property_info);
|
||||
|
||||
g_value_set_int(value, *p_val);
|
||||
return;
|
||||
}
|
||||
case NM_VALUE_TYPE_UINT32:
|
||||
{
|
||||
const guint32 *p_val =
|
||||
_nm_setting_get_private(setting, sett_info, property_info->direct_offset);
|
||||
const guint32 *p_val = _nm_setting_get_private_field(setting, sett_info, property_info);
|
||||
|
||||
g_value_set_uint(value, *p_val);
|
||||
return;
|
||||
}
|
||||
case NM_VALUE_TYPE_INT64:
|
||||
{
|
||||
const gint64 *p_val =
|
||||
_nm_setting_get_private(setting, sett_info, property_info->direct_offset);
|
||||
const gint64 *p_val = _nm_setting_get_private_field(setting, sett_info, property_info);
|
||||
|
||||
g_value_set_int64(value, *p_val);
|
||||
return;
|
||||
}
|
||||
case NM_VALUE_TYPE_UINT64:
|
||||
{
|
||||
const guint64 *p_val =
|
||||
_nm_setting_get_private(setting, sett_info, property_info->direct_offset);
|
||||
const guint64 *p_val = _nm_setting_get_private_field(setting, sett_info, property_info);
|
||||
|
||||
g_value_set_uint64(value, *p_val);
|
||||
return;
|
||||
}
|
||||
case NM_VALUE_TYPE_ENUM:
|
||||
{
|
||||
const int *p_val =
|
||||
_nm_setting_get_private(setting, sett_info, property_info->direct_offset);
|
||||
const int *p_val = _nm_setting_get_private_field(setting, sett_info, property_info);
|
||||
|
||||
g_value_set_enum(value, *p_val);
|
||||
return;
|
||||
}
|
||||
case NM_VALUE_TYPE_FLAGS:
|
||||
{
|
||||
const guint *p_val =
|
||||
_nm_setting_get_private(setting, sett_info, property_info->direct_offset);
|
||||
const guint *p_val = _nm_setting_get_private_field(setting, sett_info, property_info);
|
||||
|
||||
g_value_set_flags(value, *p_val);
|
||||
return;
|
||||
}
|
||||
case NM_VALUE_TYPE_STRING:
|
||||
{
|
||||
const char *const *p_val =
|
||||
_nm_setting_get_private(setting, sett_info, property_info->direct_offset);
|
||||
const char *const *p_val = _nm_setting_get_private_field(setting, sett_info, property_info);
|
||||
|
||||
g_value_set_string(value, *p_val);
|
||||
return;
|
||||
|
|
@ -777,7 +769,7 @@ _nm_setting_property_get_property_direct(GObject *object,
|
|||
case NM_VALUE_TYPE_BYTES:
|
||||
{
|
||||
const GBytes *const *p_val =
|
||||
_nm_setting_get_private(setting, sett_info, property_info->direct_offset);
|
||||
_nm_setting_get_private_field(setting, sett_info, property_info);
|
||||
|
||||
g_value_set_boxed(value, *p_val);
|
||||
return;
|
||||
|
|
@ -814,7 +806,7 @@ _nm_setting_property_set_property_direct(GObject *object,
|
|||
switch (property_info->property_type->direct_type) {
|
||||
case NM_VALUE_TYPE_BOOL:
|
||||
{
|
||||
bool *p_val = _nm_setting_get_private(setting, sett_info, property_info->direct_offset);
|
||||
bool *p_val = _nm_setting_get_private_field(setting, sett_info, property_info);
|
||||
gboolean v;
|
||||
|
||||
v = g_value_get_boolean(value);
|
||||
|
|
@ -825,7 +817,7 @@ _nm_setting_property_set_property_direct(GObject *object,
|
|||
}
|
||||
case NM_VALUE_TYPE_INT32:
|
||||
{
|
||||
gint32 *p_val = _nm_setting_get_private(setting, sett_info, property_info->direct_offset);
|
||||
gint32 *p_val = _nm_setting_get_private_field(setting, sett_info, property_info);
|
||||
int v;
|
||||
|
||||
v = g_value_get_int(value);
|
||||
|
|
@ -840,7 +832,7 @@ _nm_setting_property_set_property_direct(GObject *object,
|
|||
}
|
||||
case NM_VALUE_TYPE_UINT32:
|
||||
{
|
||||
guint32 *p_val = _nm_setting_get_private(setting, sett_info, property_info->direct_offset);
|
||||
guint32 *p_val = _nm_setting_get_private_field(setting, sett_info, property_info);
|
||||
guint v;
|
||||
|
||||
v = g_value_get_uint(value);
|
||||
|
|
@ -855,7 +847,7 @@ _nm_setting_property_set_property_direct(GObject *object,
|
|||
}
|
||||
case NM_VALUE_TYPE_INT64:
|
||||
{
|
||||
gint64 *p_val = _nm_setting_get_private(setting, sett_info, property_info->direct_offset);
|
||||
gint64 *p_val = _nm_setting_get_private_field(setting, sett_info, property_info);
|
||||
gint64 v;
|
||||
|
||||
v = g_value_get_int64(value);
|
||||
|
|
@ -866,7 +858,7 @@ _nm_setting_property_set_property_direct(GObject *object,
|
|||
}
|
||||
case NM_VALUE_TYPE_UINT64:
|
||||
{
|
||||
guint64 *p_val = _nm_setting_get_private(setting, sett_info, property_info->direct_offset);
|
||||
guint64 *p_val = _nm_setting_get_private_field(setting, sett_info, property_info);
|
||||
guint64 v;
|
||||
|
||||
v = g_value_get_uint64(value);
|
||||
|
|
@ -877,7 +869,7 @@ _nm_setting_property_set_property_direct(GObject *object,
|
|||
}
|
||||
case NM_VALUE_TYPE_ENUM:
|
||||
{
|
||||
int *p_val = _nm_setting_get_private(setting, sett_info, property_info->direct_offset);
|
||||
int *p_val = _nm_setting_get_private_field(setting, sett_info, property_info);
|
||||
int v;
|
||||
|
||||
v = g_value_get_enum(value);
|
||||
|
|
@ -888,7 +880,7 @@ _nm_setting_property_set_property_direct(GObject *object,
|
|||
}
|
||||
case NM_VALUE_TYPE_FLAGS:
|
||||
{
|
||||
guint *p_val = _nm_setting_get_private(setting, sett_info, property_info->direct_offset);
|
||||
guint *p_val = _nm_setting_get_private_field(setting, sett_info, property_info);
|
||||
guint v;
|
||||
|
||||
v = g_value_get_flags(value);
|
||||
|
|
@ -906,7 +898,7 @@ _nm_setting_property_set_property_direct(GObject *object,
|
|||
goto out_notify;
|
||||
case NM_VALUE_TYPE_BYTES:
|
||||
{
|
||||
GBytes **p_val = _nm_setting_get_private(setting, sett_info, property_info->direct_offset);
|
||||
GBytes **p_val = _nm_setting_get_private_field(setting, sett_info, property_info);
|
||||
GBytes *v;
|
||||
_nm_unused gs_unref_bytes GBytes *old = NULL;
|
||||
|
||||
|
|
@ -957,7 +949,7 @@ _init_direct(NMSetting *setting)
|
|||
break;
|
||||
case NM_VALUE_TYPE_BOOL:
|
||||
{
|
||||
bool *p_val = _nm_setting_get_private(setting, sett_info, property_info->direct_offset);
|
||||
bool *p_val = _nm_setting_get_private_field(setting, sett_info, property_info);
|
||||
gboolean def_val;
|
||||
|
||||
def_val = NM_G_PARAM_SPEC_GET_DEFAULT_BOOLEAN(property_info->param_spec);
|
||||
|
|
@ -967,9 +959,8 @@ _init_direct(NMSetting *setting)
|
|||
}
|
||||
case NM_VALUE_TYPE_INT32:
|
||||
{
|
||||
gint32 *p_val =
|
||||
_nm_setting_get_private(setting, sett_info, property_info->direct_offset);
|
||||
int def_val;
|
||||
gint32 *p_val = _nm_setting_get_private_field(setting, sett_info, property_info);
|
||||
int def_val;
|
||||
|
||||
def_val = NM_G_PARAM_SPEC_GET_DEFAULT_INT(property_info->param_spec);
|
||||
nm_assert(*p_val == 0);
|
||||
|
|
@ -978,9 +969,8 @@ _init_direct(NMSetting *setting)
|
|||
}
|
||||
case NM_VALUE_TYPE_UINT32:
|
||||
{
|
||||
guint32 *p_val =
|
||||
_nm_setting_get_private(setting, sett_info, property_info->direct_offset);
|
||||
guint def_val;
|
||||
guint32 *p_val = _nm_setting_get_private_field(setting, sett_info, property_info);
|
||||
guint def_val;
|
||||
|
||||
def_val = NM_G_PARAM_SPEC_GET_DEFAULT_UINT(property_info->param_spec);
|
||||
nm_assert(*p_val == 0);
|
||||
|
|
@ -989,9 +979,8 @@ _init_direct(NMSetting *setting)
|
|||
}
|
||||
case NM_VALUE_TYPE_INT64:
|
||||
{
|
||||
gint64 *p_val =
|
||||
_nm_setting_get_private(setting, sett_info, property_info->direct_offset);
|
||||
gint64 def_val;
|
||||
gint64 *p_val = _nm_setting_get_private_field(setting, sett_info, property_info);
|
||||
gint64 def_val;
|
||||
|
||||
def_val = NM_G_PARAM_SPEC_GET_DEFAULT_INT64(property_info->param_spec);
|
||||
nm_assert(*p_val == 0);
|
||||
|
|
@ -1000,9 +989,8 @@ _init_direct(NMSetting *setting)
|
|||
}
|
||||
case NM_VALUE_TYPE_UINT64:
|
||||
{
|
||||
guint64 *p_val =
|
||||
_nm_setting_get_private(setting, sett_info, property_info->direct_offset);
|
||||
guint64 def_val;
|
||||
guint64 *p_val = _nm_setting_get_private_field(setting, sett_info, property_info);
|
||||
guint64 def_val;
|
||||
|
||||
def_val = NM_G_PARAM_SPEC_GET_DEFAULT_UINT64(property_info->param_spec);
|
||||
nm_assert(*p_val == 0);
|
||||
|
|
@ -1011,7 +999,7 @@ _init_direct(NMSetting *setting)
|
|||
}
|
||||
case NM_VALUE_TYPE_ENUM:
|
||||
{
|
||||
int *p_val = _nm_setting_get_private(setting, sett_info, property_info->direct_offset);
|
||||
int *p_val = _nm_setting_get_private_field(setting, sett_info, property_info);
|
||||
int def_val;
|
||||
|
||||
def_val = NM_G_PARAM_SPEC_GET_DEFAULT_ENUM(property_info->param_spec);
|
||||
|
|
@ -1021,9 +1009,8 @@ _init_direct(NMSetting *setting)
|
|||
}
|
||||
case NM_VALUE_TYPE_FLAGS:
|
||||
{
|
||||
guint *p_val =
|
||||
_nm_setting_get_private(setting, sett_info, property_info->direct_offset);
|
||||
guint def_val;
|
||||
guint *p_val = _nm_setting_get_private_field(setting, sett_info, property_info);
|
||||
guint def_val;
|
||||
|
||||
def_val = NM_G_PARAM_SPEC_GET_DEFAULT_FLAGS(property_info->param_spec);
|
||||
nm_assert(*p_val == 0);
|
||||
|
|
@ -1032,14 +1019,12 @@ _init_direct(NMSetting *setting)
|
|||
}
|
||||
case NM_VALUE_TYPE_STRING:
|
||||
nm_assert(!NM_G_PARAM_SPEC_GET_DEFAULT_STRING(property_info->param_spec));
|
||||
nm_assert(!(
|
||||
*((const char *const *)
|
||||
_nm_setting_get_private(setting, sett_info, property_info->direct_offset))));
|
||||
nm_assert(!(*((const char *const *)
|
||||
_nm_setting_get_private_field(setting, sett_info, property_info))));
|
||||
break;
|
||||
case NM_VALUE_TYPE_BYTES:
|
||||
nm_assert(!(
|
||||
*((const GBytes *const *)
|
||||
_nm_setting_get_private(setting, sett_info, property_info->direct_offset))));
|
||||
nm_assert(!(*((const GBytes *const *)
|
||||
_nm_setting_get_private_field(setting, sett_info, property_info))));
|
||||
break;
|
||||
default:
|
||||
nm_assert_not_reached();
|
||||
|
|
@ -1079,8 +1064,7 @@ _finalize_direct(NMSetting *setting)
|
|||
break;
|
||||
case NM_VALUE_TYPE_STRING:
|
||||
{
|
||||
char **p_val =
|
||||
_nm_setting_get_private(setting, sett_info, property_info->direct_offset);
|
||||
char **p_val = _nm_setting_get_private_field(setting, sett_info, property_info);
|
||||
|
||||
if (property_info->direct_string_is_refstr)
|
||||
nm_clear_pointer(p_val, nm_ref_string_unref_upcast);
|
||||
|
|
@ -1092,8 +1076,7 @@ _finalize_direct(NMSetting *setting)
|
|||
}
|
||||
case NM_VALUE_TYPE_BYTES:
|
||||
{
|
||||
GBytes **p_val =
|
||||
_nm_setting_get_private(setting, sett_info, property_info->direct_offset);
|
||||
GBytes **p_val = _nm_setting_get_private_field(setting, sett_info, property_info);
|
||||
|
||||
nm_clear_pointer(p_val, g_bytes_unref);
|
||||
break;
|
||||
|
|
@ -1115,7 +1098,7 @@ _nm_setting_property_to_dbus_fcn_direct(_NM_SETT_INFO_PROP_TO_DBUS_FCN_ARGS _nm_
|
|||
{
|
||||
gboolean val;
|
||||
|
||||
val = *((bool *) _nm_setting_get_private(setting, sett_info, property_info->direct_offset));
|
||||
val = *((bool *) _nm_setting_get_private_field(setting, sett_info, property_info));
|
||||
if (!property_info->to_dbus_including_default
|
||||
&& val == NM_G_PARAM_SPEC_GET_DEFAULT_BOOLEAN(property_info->param_spec))
|
||||
return NULL;
|
||||
|
|
@ -1125,8 +1108,7 @@ _nm_setting_property_to_dbus_fcn_direct(_NM_SETT_INFO_PROP_TO_DBUS_FCN_ARGS _nm_
|
|||
{
|
||||
gint32 val;
|
||||
|
||||
val =
|
||||
*((gint32 *) _nm_setting_get_private(setting, sett_info, property_info->direct_offset));
|
||||
val = *((gint32 *) _nm_setting_get_private_field(setting, sett_info, property_info));
|
||||
if (!property_info->to_dbus_including_default
|
||||
&& val == NM_G_PARAM_SPEC_GET_DEFAULT_INT(property_info->param_spec))
|
||||
return NULL;
|
||||
|
|
@ -1136,8 +1118,7 @@ _nm_setting_property_to_dbus_fcn_direct(_NM_SETT_INFO_PROP_TO_DBUS_FCN_ARGS _nm_
|
|||
{
|
||||
guint32 val;
|
||||
|
||||
val = *(
|
||||
(guint32 *) _nm_setting_get_private(setting, sett_info, property_info->direct_offset));
|
||||
val = *((guint32 *) _nm_setting_get_private_field(setting, sett_info, property_info));
|
||||
if (!property_info->to_dbus_including_default
|
||||
&& val == NM_G_PARAM_SPEC_GET_DEFAULT_UINT(property_info->param_spec))
|
||||
return NULL;
|
||||
|
|
@ -1147,8 +1128,7 @@ _nm_setting_property_to_dbus_fcn_direct(_NM_SETT_INFO_PROP_TO_DBUS_FCN_ARGS _nm_
|
|||
{
|
||||
gint64 val;
|
||||
|
||||
val =
|
||||
*((gint64 *) _nm_setting_get_private(setting, sett_info, property_info->direct_offset));
|
||||
val = *((gint64 *) _nm_setting_get_private_field(setting, sett_info, property_info));
|
||||
if (!property_info->to_dbus_including_default
|
||||
&& val == NM_G_PARAM_SPEC_GET_DEFAULT_INT64(property_info->param_spec))
|
||||
return NULL;
|
||||
|
|
@ -1158,8 +1138,7 @@ _nm_setting_property_to_dbus_fcn_direct(_NM_SETT_INFO_PROP_TO_DBUS_FCN_ARGS _nm_
|
|||
{
|
||||
guint64 val;
|
||||
|
||||
val = *(
|
||||
(guint64 *) _nm_setting_get_private(setting, sett_info, property_info->direct_offset));
|
||||
val = *((guint64 *) _nm_setting_get_private_field(setting, sett_info, property_info));
|
||||
if (!property_info->to_dbus_including_default
|
||||
&& val == NM_G_PARAM_SPEC_GET_DEFAULT_UINT64(property_info->param_spec))
|
||||
return NULL;
|
||||
|
|
@ -1169,7 +1148,7 @@ _nm_setting_property_to_dbus_fcn_direct(_NM_SETT_INFO_PROP_TO_DBUS_FCN_ARGS _nm_
|
|||
{
|
||||
int val;
|
||||
|
||||
val = *((int *) _nm_setting_get_private(setting, sett_info, property_info->direct_offset));
|
||||
val = *((int *) _nm_setting_get_private_field(setting, sett_info, property_info));
|
||||
if (!property_info->to_dbus_including_default
|
||||
&& val == NM_G_PARAM_SPEC_GET_DEFAULT_ENUM(property_info->param_spec))
|
||||
return NULL;
|
||||
|
|
@ -1179,8 +1158,7 @@ _nm_setting_property_to_dbus_fcn_direct(_NM_SETT_INFO_PROP_TO_DBUS_FCN_ARGS _nm_
|
|||
{
|
||||
guint val;
|
||||
|
||||
val =
|
||||
*((guint *) _nm_setting_get_private(setting, sett_info, property_info->direct_offset));
|
||||
val = *((guint *) _nm_setting_get_private_field(setting, sett_info, property_info));
|
||||
if (!property_info->to_dbus_including_default
|
||||
&& val == NM_G_PARAM_SPEC_GET_DEFAULT_FLAGS(property_info->param_spec))
|
||||
return NULL;
|
||||
|
|
@ -1198,9 +1176,8 @@ _nm_setting_property_to_dbus_fcn_direct(_NM_SETT_INFO_PROP_TO_DBUS_FCN_ARGS _nm_
|
|||
nm_assert(!NM_G_PARAM_SPEC_GET_DEFAULT_STRING(property_info->param_spec));
|
||||
nm_assert(!property_info->to_dbus_including_default);
|
||||
|
||||
val = *((const char *const *) _nm_setting_get_private(setting,
|
||||
sett_info,
|
||||
property_info->direct_offset));
|
||||
val = *(
|
||||
(const char *const *) _nm_setting_get_private_field(setting, sett_info, property_info));
|
||||
if (!val)
|
||||
return NULL;
|
||||
if (!val[0])
|
||||
|
|
@ -1215,9 +1192,9 @@ _nm_setting_property_to_dbus_fcn_direct(_NM_SETT_INFO_PROP_TO_DBUS_FCN_ARGS _nm_
|
|||
* (but it could have). */
|
||||
nm_assert(!property_info->to_dbus_including_default);
|
||||
|
||||
val = *((const GBytes *const *) _nm_setting_get_private(setting,
|
||||
sett_info,
|
||||
property_info->direct_offset));
|
||||
val = *((const GBytes *const *) _nm_setting_get_private_field(setting,
|
||||
sett_info,
|
||||
property_info));
|
||||
if (!val)
|
||||
return NULL;
|
||||
return nm_g_bytes_to_variant_ay(val);
|
||||
|
|
@ -1237,9 +1214,7 @@ _nm_setting_property_to_dbus_fcn_direct_mac_address(_NM_SETT_INFO_PROP_TO_DBUS_F
|
|||
nm_assert(!NM_G_PARAM_SPEC_GET_DEFAULT_STRING(property_info->param_spec));
|
||||
nm_assert(!property_info->to_dbus_including_default);
|
||||
|
||||
val = *((const char *const *) _nm_setting_get_private(setting,
|
||||
sett_info,
|
||||
property_info->direct_offset));
|
||||
val = *((const char *const *) _nm_setting_get_private_field(setting, sett_info, property_info));
|
||||
return nm_utils_hwaddr_to_dbus(val);
|
||||
}
|
||||
|
||||
|
|
@ -1307,9 +1282,8 @@ _nm_setting_property_from_dbus_fcn_direct_mac_address(_NM_SETT_INFO_PROP_FROM_DB
|
|||
|
||||
array = g_variant_get_fixed_array(value, &length, 1);
|
||||
|
||||
if (nm_strdup_reset_take(
|
||||
_nm_setting_get_private(setting, sett_info, property_info->direct_offset),
|
||||
length > 0 ? nm_utils_hwaddr_ntoa(array, length) : NULL)) {
|
||||
if (nm_strdup_reset_take(_nm_setting_get_private_field(setting, sett_info, property_info),
|
||||
length > 0 ? nm_utils_hwaddr_ntoa(array, length) : NULL)) {
|
||||
g_object_notify_by_pspec(G_OBJECT(setting), property_info->param_spec);
|
||||
} else
|
||||
*out_is_modified = FALSE;
|
||||
|
|
@ -1365,7 +1339,7 @@ _nm_setting_property_from_dbus_fcn_direct(_NM_SETT_INFO_PROP_FROM_DBUS_FCN_ARGS
|
|||
v = !!v;
|
||||
}
|
||||
|
||||
p_val = _nm_setting_get_private(setting, sett_info, property_info->direct_offset);
|
||||
p_val = _nm_setting_get_private_field(setting, sett_info, property_info);
|
||||
if (*p_val == v)
|
||||
goto out_unchanged;
|
||||
*p_val = v;
|
||||
|
|
@ -1389,7 +1363,7 @@ _nm_setting_property_from_dbus_fcn_direct(_NM_SETT_INFO_PROP_FROM_DBUS_FCN_ARGS
|
|||
goto out_error_wrong_dbus_type;
|
||||
}
|
||||
|
||||
p_val = _nm_setting_get_private(setting, sett_info, property_info->direct_offset);
|
||||
p_val = _nm_setting_get_private_field(setting, sett_info, property_info);
|
||||
if (*p_val == v)
|
||||
goto out_unchanged;
|
||||
|
||||
|
|
@ -1417,7 +1391,7 @@ _nm_setting_property_from_dbus_fcn_direct(_NM_SETT_INFO_PROP_FROM_DBUS_FCN_ARGS
|
|||
goto out_error_wrong_dbus_type;
|
||||
}
|
||||
|
||||
p_val = _nm_setting_get_private(setting, sett_info, property_info->direct_offset);
|
||||
p_val = _nm_setting_get_private_field(setting, sett_info, property_info);
|
||||
if (*p_val == v)
|
||||
goto out_unchanged;
|
||||
|
||||
|
|
@ -1444,7 +1418,7 @@ _nm_setting_property_from_dbus_fcn_direct(_NM_SETT_INFO_PROP_FROM_DBUS_FCN_ARGS
|
|||
goto out_error_wrong_dbus_type;
|
||||
}
|
||||
|
||||
p_val = _nm_setting_get_private(setting, sett_info, property_info->direct_offset);
|
||||
p_val = _nm_setting_get_private_field(setting, sett_info, property_info);
|
||||
if (*p_val == v)
|
||||
goto out_unchanged;
|
||||
|
||||
|
|
@ -1471,7 +1445,7 @@ _nm_setting_property_from_dbus_fcn_direct(_NM_SETT_INFO_PROP_FROM_DBUS_FCN_ARGS
|
|||
goto out_error_wrong_dbus_type;
|
||||
}
|
||||
|
||||
p_val = _nm_setting_get_private(setting, sett_info, property_info->direct_offset);
|
||||
p_val = _nm_setting_get_private_field(setting, sett_info, property_info);
|
||||
if (*p_val == v)
|
||||
goto out_unchanged;
|
||||
|
||||
|
|
@ -1501,7 +1475,7 @@ _nm_setting_property_from_dbus_fcn_direct(_NM_SETT_INFO_PROP_FROM_DBUS_FCN_ARGS
|
|||
goto out_error_wrong_dbus_type;
|
||||
}
|
||||
|
||||
p_val = _nm_setting_get_private(setting, sett_info, property_info->direct_offset);
|
||||
p_val = _nm_setting_get_private_field(setting, sett_info, property_info);
|
||||
if (*p_val == v)
|
||||
goto out_unchanged;
|
||||
|
||||
|
|
@ -1530,7 +1504,7 @@ _nm_setting_property_from_dbus_fcn_direct(_NM_SETT_INFO_PROP_FROM_DBUS_FCN_ARGS
|
|||
goto out_error_wrong_dbus_type;
|
||||
}
|
||||
|
||||
p_val = _nm_setting_get_private(setting, sett_info, property_info->direct_offset);
|
||||
p_val = _nm_setting_get_private_field(setting, sett_info, property_info);
|
||||
if (*p_val == v)
|
||||
goto out_unchanged;
|
||||
|
||||
|
|
@ -1576,7 +1550,7 @@ _nm_setting_property_from_dbus_fcn_direct(_NM_SETT_INFO_PROP_FROM_DBUS_FCN_ARGS
|
|||
|
||||
v = nm_g_bytes_new_from_variant_ay(value);
|
||||
|
||||
p_val = _nm_setting_get_private(setting, sett_info, property_info->direct_offset);
|
||||
p_val = _nm_setting_get_private_field(setting, sett_info, property_info);
|
||||
if (nm_g_bytes_equal0(*p_val, v))
|
||||
goto out_unchanged;
|
||||
|
||||
|
|
@ -2469,8 +2443,8 @@ _nm_setting_property_compare_fcn_direct(_NM_SETT_INFO_PROP_COMPARE_FCN_ARGS _nm_
|
|||
if (!set_b)
|
||||
return TRUE;
|
||||
|
||||
p_a = _nm_setting_get_private(set_a, sett_info, property_info->direct_offset);
|
||||
p_b = _nm_setting_get_private(set_b, sett_info, property_info->direct_offset);
|
||||
p_a = _nm_setting_get_private_field(set_a, sett_info, property_info);
|
||||
p_b = _nm_setting_get_private_field(set_b, sett_info, property_info);
|
||||
|
||||
switch (property_info->property_type->direct_type) {
|
||||
case NM_VALUE_TYPE_BOOL:
|
||||
|
|
|
|||
|
|
@ -889,6 +889,20 @@ _nm_setting_get_private(NMSetting *self, const NMSettInfoSetting *sett_info, gui
|
|||
return ((((char *) ((gpointer) self)) + sett_info->private_offset) + offset);
|
||||
}
|
||||
|
||||
static inline gpointer
|
||||
_nm_setting_get_private_field(NMSetting *self,
|
||||
const NMSettInfoSetting *sett_info,
|
||||
const NMSettInfoProperty *prop_info)
|
||||
{
|
||||
nm_assert(sett_info);
|
||||
nm_assert(prop_info);
|
||||
nm_assert(prop_info->property_type);
|
||||
nm_assert(prop_info->property_type->direct_type > NM_VALUE_TYPE_UNSPEC);
|
||||
nm_assert(sett_info->private_offset != 0 || prop_info->direct_offset != 0);
|
||||
|
||||
return _nm_setting_get_private(self, sett_info, prop_info->direct_offset);
|
||||
}
|
||||
|
||||
static inline const NMSettInfoProperty *
|
||||
_nm_sett_info_property_info_get_sorted(const NMSettInfoSetting *sett_info, guint16 idx)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue