Skip to content

Commit

Permalink
ostree/summary: Eliminate redundant gotos from error handling path
Browse files Browse the repository at this point in the history
There is no error handling to do, so just return everywhere instead.

Signed-off-by: Philip Withnall <[email protected]>

Closes: #1158
Approved by: cgwalters
  • Loading branch information
pwithnall authored and rh-atomic-bot committed Oct 2, 2017
1 parent d1a5652 commit 16aa4d7
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions src/ostree/ot-builtin-summary.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,32 +83,31 @@ build_additional_metadata (const char * const *args,
gboolean
ostree_builtin_summary (int argc, char **argv, GCancellable *cancellable, GError **error)
{
gboolean ret = FALSE;
g_autoptr(GOptionContext) context = NULL;
g_autoptr(OstreeRepo) repo = NULL;
OstreeDumpFlags flags = OSTREE_DUMP_NONE;

context = g_option_context_new ("Manage summary metadata");

if (!ostree_option_context_parse (context, options, &argc, &argv, OSTREE_BUILTIN_FLAG_NONE, &repo, cancellable, error))
goto out;
return FALSE;

if (opt_update)
{
g_autoptr(GVariant) additional_metadata = NULL;

if (!ostree_ensure_repo_writable (repo, error))
goto out;
return FALSE;

if (opt_metadata != NULL)
{
additional_metadata = build_additional_metadata ((const char * const *) opt_metadata, error);
if (additional_metadata == NULL)
goto out;
return FALSE;
}

if (!ostree_repo_regenerate_summary (repo, additional_metadata, cancellable, error))
goto out;
return FALSE;

if (opt_key_ids)
{
Expand All @@ -117,7 +116,7 @@ ostree_builtin_summary (int argc, char **argv, GCancellable *cancellable, GError
opt_gpg_homedir,
cancellable,
error))
goto out;
return FALSE;
}
}
else if (opt_view)
Expand All @@ -129,18 +128,16 @@ ostree_builtin_summary (int argc, char **argv, GCancellable *cancellable, GError

summary_data = ot_file_mapat_bytes (repo->repo_dir_fd, "summary", error);
if (!summary_data)
goto out;
return FALSE;

ot_dump_summary_bytes (summary_data, flags);
}
else
{
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
"No option specified; use -u to update summary");
goto out;
return FALSE;
}

ret = TRUE;
out:
return ret;
return TRUE;
}

0 comments on commit 16aa4d7

Please sign in to comment.