diff options
author | Thomas Haller <thaller@redhat.com> | 2016-02-28 16:25:36 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2016-03-03 18:54:20 +0100 |
commit | 01b9b4104c365002fae5e45b564956062fe146d4 (patch) | |
tree | de72d05b95706d94a8750d9870768b61edf8b98a /libnm-glib | |
parent | 7871d850f50975b46f7909bc6bd3cce434c7c60e (diff) | |
download | NetworkManager-01b9b4104c365002fae5e45b564956062fe146d4.tar.gz |
all: clean-up usage of GError
Functions that take a GError** MUST fill it in on error. There is no
need to check whether error is NULL if the function it was passed to
had a failing return value.
Likewise, a proper GError must have a non-NULL message, so there's no
need to double-check that either.
Based-on-patch-by: Dan Winship <danw@gnome.org>
Diffstat (limited to 'libnm-glib')
-rw-r--r-- | libnm-glib/nm-client.c | 4 | ||||
-rw-r--r-- | libnm-glib/nm-device.c | 4 | ||||
-rw-r--r-- | libnm-glib/nm-remote-connection.c | 3 | ||||
-rw-r--r-- | libnm-glib/nm-secret-agent.c | 3 |
4 files changed, 6 insertions, 8 deletions
diff --git a/libnm-glib/nm-client.c b/libnm-glib/nm-client.c index fc105e53e7..3c0564684b 100644 --- a/libnm-glib/nm-client.c +++ b/libnm-glib/nm-client.c @@ -812,8 +812,8 @@ nm_client_deactivate_connection (NMClient *client, NMActiveConnection *active) DBUS_TYPE_G_OBJECT_PATH, path, G_TYPE_INVALID, G_TYPE_INVALID)) { - g_warning ("Could not deactivate connection '%s': %s", - path, error ? error->message : "(unknown)"); + g_warning ("Could not deactivate connection '%s': %s", + path, NM_G_ERROR_MSG (error)); g_clear_error (&error); } } diff --git a/libnm-glib/nm-device.c b/libnm-glib/nm-device.c index 312f970059..779f4b7c1c 100644 --- a/libnm-glib/nm-device.c +++ b/libnm-glib/nm-device.c @@ -2202,8 +2202,8 @@ device_operation_cb (DBusGProxy *proxy, __func__, nm_object_get_path (NM_OBJECT (info->device)), info->method, - error ? error->code : -1, - error && error->message ? error->message : "(unknown)"); + error->code, + NM_G_ERROR_MSG (error)); } g_clear_error (&error); diff --git a/libnm-glib/nm-remote-connection.c b/libnm-glib/nm-remote-connection.c index 2031b27f11..e043fdb1a8 100644 --- a/libnm-glib/nm-remote-connection.c +++ b/libnm-glib/nm-remote-connection.c @@ -457,8 +457,7 @@ replace_settings (NMRemoteConnection *self, GHashTable *new_settings) g_warning ("%s: error updating connection %s settings: (%d) %s", __func__, nm_connection_get_path (NM_CONNECTION (self)), - error ? error->code : -1, - (error && error->message) ? error->message : "(unknown)"); + error->code, error->message); g_clear_error (&error); g_signal_emit (self, signals[REMOVED], 0); diff --git a/libnm-glib/nm-secret-agent.c b/libnm-glib/nm-secret-agent.c index a0966f9f6c..073729da5d 100644 --- a/libnm-glib/nm-secret-agent.c +++ b/libnm-glib/nm-secret-agent.c @@ -331,8 +331,7 @@ verify_request (NMSecretAgent *self, NM_SECRET_AGENT_ERROR, NM_SECRET_AGENT_ERROR_INVALID_CONNECTION, "Invalid connection: (%d) %s", - local ? local->code : -1, - (local && local->message) ? local->message : "(unknown)"); + local->code, local->message); g_clear_error (&local); } |