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>
This commit is contained in:
Thomas Haller
2016-02-28 16:25:36 +01:00
parent 7871d850f5
commit 01b9b4104c
32 changed files with 79 additions and 91 deletions

View File

@@ -380,8 +380,8 @@ dhclient_start (NMDhcpClient *client,
if (!success) {
nm_log_warn (log_domain, "(%s): failed to save DUID to %s: (%d) %s.",
iface, priv->lease_file,
error ? error->code : -1,
error && error->message ? error->message : "(unknown)");
error->code,
error->message);
g_free (pid_file);
return FALSE;
}
@@ -591,8 +591,8 @@ get_duid (NMDhcpClient *client)
if (error) {
nm_log_warn (LOGD_DHCP, "Failed to read leasefile '%s': (%d) %s",
priv->def_leasefile,
error ? error->code : -1,
error ? error->message : "(unknown)");
error->code,
error->message);
g_clear_error (&error);
}
}