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.
This commit is contained in:
Thomas Haller 2018-03-29 08:30:26 +02:00
parent 2a30bef856
commit 8171362d02

View file

@ -25,6 +25,7 @@
#include <string.h>
#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;