guri: Remove unnecessary NULL pointer check

`uri` is always non-`NULL` by the time the `fail` label is reached, so
drop the `NULL` pointer check. Inline the `fail` code since it’s only
used from two places.

Coverity CID: #1430970
Signed-off-by: Philip Withnall <withnall@endlessm.com>
This commit is contained in:
Philip Withnall 2020-09-08 09:59:24 +01:00
parent 2effedd75b
commit f19cb44b98

View File

@ -1257,13 +1257,17 @@ g_uri_parse_relative (GUri *base_uri,
&uri->host, &uri->port, &uri->host, &uri->port,
&uri->path, &uri->query, &uri->fragment, &uri->path, &uri->query, &uri->fragment,
error)) error))
goto fail; {
g_uri_unref (uri);
return NULL;
}
if (!uri->scheme && !base_uri) if (!uri->scheme && !base_uri)
{ {
g_set_error_literal (error, G_URI_ERROR, G_URI_ERROR_FAILED, g_set_error_literal (error, G_URI_ERROR, G_URI_ERROR_FAILED,
_("URI is not absolute, and no base URI was provided")); _("URI is not absolute, and no base URI was provided"));
goto fail; g_uri_unref (uri);
return NULL;
} }
if (base_uri) if (base_uri)
@ -1326,11 +1330,6 @@ g_uri_parse_relative (GUri *base_uri,
} }
return g_steal_pointer (&uri); return g_steal_pointer (&uri);
fail:
if (uri)
g_uri_unref (uri);
return NULL;
} }
/** /**