ostree/summary: Eliminate redundant gotos from error handling path
There is no error handling to do, so just return everywhere instead. Signed-off-by: Philip Withnall <withnall@endlessm.com> Closes: #1158 Approved by: cgwalters
This commit is contained in:
parent
d1a5652bdd
commit
16aa4d728a
|
|
@ -83,7 +83,6 @@ build_additional_metadata (const char * const *args,
|
||||||
gboolean
|
gboolean
|
||||||
ostree_builtin_summary (int argc, char **argv, GCancellable *cancellable, GError **error)
|
ostree_builtin_summary (int argc, char **argv, GCancellable *cancellable, GError **error)
|
||||||
{
|
{
|
||||||
gboolean ret = FALSE;
|
|
||||||
g_autoptr(GOptionContext) context = NULL;
|
g_autoptr(GOptionContext) context = NULL;
|
||||||
g_autoptr(OstreeRepo) repo = NULL;
|
g_autoptr(OstreeRepo) repo = NULL;
|
||||||
OstreeDumpFlags flags = OSTREE_DUMP_NONE;
|
OstreeDumpFlags flags = OSTREE_DUMP_NONE;
|
||||||
|
|
@ -91,24 +90,24 @@ ostree_builtin_summary (int argc, char **argv, GCancellable *cancellable, GError
|
||||||
context = g_option_context_new ("Manage summary metadata");
|
context = g_option_context_new ("Manage summary metadata");
|
||||||
|
|
||||||
if (!ostree_option_context_parse (context, options, &argc, &argv, OSTREE_BUILTIN_FLAG_NONE, &repo, cancellable, error))
|
if (!ostree_option_context_parse (context, options, &argc, &argv, OSTREE_BUILTIN_FLAG_NONE, &repo, cancellable, error))
|
||||||
goto out;
|
return FALSE;
|
||||||
|
|
||||||
if (opt_update)
|
if (opt_update)
|
||||||
{
|
{
|
||||||
g_autoptr(GVariant) additional_metadata = NULL;
|
g_autoptr(GVariant) additional_metadata = NULL;
|
||||||
|
|
||||||
if (!ostree_ensure_repo_writable (repo, error))
|
if (!ostree_ensure_repo_writable (repo, error))
|
||||||
goto out;
|
return FALSE;
|
||||||
|
|
||||||
if (opt_metadata != NULL)
|
if (opt_metadata != NULL)
|
||||||
{
|
{
|
||||||
additional_metadata = build_additional_metadata ((const char * const *) opt_metadata, error);
|
additional_metadata = build_additional_metadata ((const char * const *) opt_metadata, error);
|
||||||
if (additional_metadata == NULL)
|
if (additional_metadata == NULL)
|
||||||
goto out;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ostree_repo_regenerate_summary (repo, additional_metadata, cancellable, error))
|
if (!ostree_repo_regenerate_summary (repo, additional_metadata, cancellable, error))
|
||||||
goto out;
|
return FALSE;
|
||||||
|
|
||||||
if (opt_key_ids)
|
if (opt_key_ids)
|
||||||
{
|
{
|
||||||
|
|
@ -117,7 +116,7 @@ ostree_builtin_summary (int argc, char **argv, GCancellable *cancellable, GError
|
||||||
opt_gpg_homedir,
|
opt_gpg_homedir,
|
||||||
cancellable,
|
cancellable,
|
||||||
error))
|
error))
|
||||||
goto out;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (opt_view)
|
else if (opt_view)
|
||||||
|
|
@ -129,7 +128,7 @@ ostree_builtin_summary (int argc, char **argv, GCancellable *cancellable, GError
|
||||||
|
|
||||||
summary_data = ot_file_mapat_bytes (repo->repo_dir_fd, "summary", error);
|
summary_data = ot_file_mapat_bytes (repo->repo_dir_fd, "summary", error);
|
||||||
if (!summary_data)
|
if (!summary_data)
|
||||||
goto out;
|
return FALSE;
|
||||||
|
|
||||||
ot_dump_summary_bytes (summary_data, flags);
|
ot_dump_summary_bytes (summary_data, flags);
|
||||||
}
|
}
|
||||||
|
|
@ -137,10 +136,8 @@ ostree_builtin_summary (int argc, char **argv, GCancellable *cancellable, GError
|
||||||
{
|
{
|
||||||
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
|
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
|
||||||
"No option specified; use -u to update summary");
|
"No option specified; use -u to update summary");
|
||||||
goto out;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = TRUE;
|
return TRUE;
|
||||||
out:
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue