From 8171362d02ca3fc1d68ddf0e4913b285c788510e Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Thu, 29 Mar 2018 08:30:26 +0200 Subject: [PATCH] checkpoint: minor cleanup of device_checkpoint_create() - indent with spaces for wrapped line - drop g_return_val_if_fail(). It really shouldn't happen, and if it does, we can just continue and will hit g_critical() warnings below, when using the variables. - get the NMActRequest instance first, and from there the applied and settings connection. Not the other way around. nm_device_get_settings_connection() and nm_device_get_applied_connection() are just convenience functions to get the fields from act_request. --- src/nm-checkpoint.c | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/src/nm-checkpoint.c b/src/nm-checkpoint.c index f7e857c558..da1c85883c 100644 --- a/src/nm-checkpoint.c +++ b/src/nm-checkpoint.c @@ -25,6 +25,7 @@ #include #include "nm-active-connection.h" +#include "nm-act-request.h" #include "nm-auth-subject.h" #include "nm-core-utils.h" #include "nm-dbus-interface.h" @@ -422,25 +423,21 @@ device_checkpoint_create (NMDevice *device) dev_checkpoint->realized = nm_device_is_real (device); if (nm_device_get_unmanaged_mask (device, NM_UNMANAGED_USER_EXPLICIT)) { - dev_checkpoint->unmanaged_explicit = - !!nm_device_get_unmanaged_flags (device, NM_UNMANAGED_USER_EXPLICIT); + dev_checkpoint->unmanaged_explicit = !!nm_device_get_unmanaged_flags (device, + NM_UNMANAGED_USER_EXPLICIT); } else dev_checkpoint->unmanaged_explicit = NM_UNMAN_FLAG_OP_FORGET; - applied_connection = nm_device_get_applied_connection (device); - if (applied_connection) { - dev_checkpoint->applied_connection = - nm_simple_connection_new_clone (applied_connection); + act_request = nm_device_get_act_request (device); + if (act_request) { + settings_connection = nm_act_request_get_settings_connection (act_request); + applied_connection = nm_act_request_get_applied_connection (act_request); - settings_connection = nm_device_get_settings_connection (device); - g_return_val_if_fail (settings_connection, NULL); + dev_checkpoint->applied_connection = nm_simple_connection_new_clone (applied_connection); dev_checkpoint->settings_connection = - nm_simple_connection_new_clone (NM_CONNECTION (settings_connection)); - - act_request = nm_device_get_act_request (device); - g_return_val_if_fail (act_request, NULL); + nm_simple_connection_new_clone (NM_CONNECTION (settings_connection)); dev_checkpoint->ac_version_id = - nm_active_connection_version_id_get (NM_ACTIVE_CONNECTION (act_request)); + nm_active_connection_version_id_get (NM_ACTIVE_CONNECTION (act_request)); } return dev_checkpoint;