device/bridge: code cleanup in commit_option()

This commit is contained in:
Thomas Haller 2020-04-09 09:34:17 +02:00
parent 36ab1e841f
commit 177ee2d7bf

View file

@ -329,17 +329,16 @@ commit_option (NMDevice *device, NMSetting *setting, const Option *option, gbool
GParamSpec *pspec; GParamSpec *pspec;
const char *value; const char *value;
g_assert (setting); nm_assert (NM_IS_SETTING_BRIDGE (setting));
pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (setting), option->name); pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (setting), option->name);
g_assert (pspec); nm_assert (pspec);
/* Get the property's value */
g_value_init (&val, G_PARAM_SPEC_VALUE_TYPE (pspec)); g_value_init (&val, G_PARAM_SPEC_VALUE_TYPE (pspec));
g_object_get_property ((GObject *) setting, option->name, &val); g_object_get_property ((GObject *) setting, option->name, &val);
if (option->to_sysfs) { if (option->to_sysfs) {
value = option->to_sysfs(&val); value = option->to_sysfs (&val);
goto out; goto out;
} }
@ -492,7 +491,7 @@ update_connection (NMDevice *device, NMConnection *connection)
g_value_init (&value, G_PARAM_SPEC_VALUE_TYPE (pspec)); g_value_init (&value, G_PARAM_SPEC_VALUE_TYPE (pspec));
if (option->from_sysfs) { if (option->from_sysfs) {
option->from_sysfs(str, &value); option->from_sysfs (str, &value);
goto out; goto out;
} }
@ -530,7 +529,7 @@ update_connection (NMDevice *device, NMConnection *connection)
g_value_set_string (&value, str); g_value_set_string (&value, str);
break; break;
default: default:
nm_assert_not_reached(); nm_assert_not_reached ();
break; break;
} }