Skip to content

Commit

Permalink
Merge pull request #2993 from cgwalters/misc-c99-style-2
Browse files Browse the repository at this point in the history
Misc c99 style 2
  • Loading branch information
ericcurtin authored Aug 18, 2023
2 parents f7786e7 + 22b4778 commit ee1e585
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 23 deletions.
5 changes: 2 additions & 3 deletions src/libostree/ostree-lzma-compressor.c
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ _ostree_lzma_compressor_convert (GConverter *converter, const void *inbuf, gsize
{
res = lzma_easy_encoder (&self->lstream, 8, LZMA_CHECK_CRC64);
if (res != LZMA_OK)
goto out;
return _ostree_lzma_return (res, error);
self->initialized = TRUE;
}

Expand All @@ -187,12 +187,11 @@ _ostree_lzma_compressor_convert (GConverter *converter, const void *inbuf, gsize

res = lzma_code (&self->lstream, action);
if (res != LZMA_OK && res != LZMA_STREAM_END)
goto out;
return _ostree_lzma_return (res, error);

*bytes_read = inbuf_size - self->lstream.avail_in;
*bytes_written = outbuf_size - self->lstream.avail_out;

out:
return _ostree_lzma_return (res, error);
}

Expand Down
33 changes: 13 additions & 20 deletions src/ostree/ot-builtin-checkout.c
Original file line number Diff line number Diff line change
Expand Up @@ -260,15 +260,9 @@ static gboolean
process_many_checkouts (OstreeRepo *repo, const char *target, GCancellable *cancellable,
GError **error)
{
gboolean ret = FALSE;
gsize len;
GError *temp_error = NULL;
g_autoptr (GInputStream) instream = NULL;
g_autoptr (GDataInputStream) datastream = NULL;
g_autofree char *revision = NULL;
g_autofree char *subpath = NULL;
g_autofree char *resolved_commit = NULL;

g_autoptr (GInputStream) instream = NULL;
if (opt_from_stdin)
{
instream = (GInputStream *)g_unix_input_stream_new (0, FALSE);
Expand All @@ -279,11 +273,14 @@ process_many_checkouts (OstreeRepo *repo, const char *target, GCancellable *canc

instream = (GInputStream *)g_file_read (f, cancellable, error);
if (!instream)
goto out;
return FALSE;
}

datastream = g_data_input_stream_new (instream);
g_autoptr (GDataInputStream) datastream = g_data_input_stream_new (instream);

g_autofree char *resolved_commit = NULL;
g_autofree char *revision = NULL;
gsize len;
while (
(revision = g_data_input_stream_read_upto (datastream, "", 1, &len, cancellable, &temp_error))
!= NULL)
Expand All @@ -293,37 +290,33 @@ process_many_checkouts (OstreeRepo *repo, const char *target, GCancellable *canc

/* Read the null byte */
(void)g_data_input_stream_read_byte (datastream, cancellable, NULL);
g_free (subpath);
subpath = g_data_input_stream_read_upto (datastream, "", 1, &len, cancellable, &temp_error);
g_autofree char *subpath
= g_data_input_stream_read_upto (datastream, "", 1, &len, cancellable, &temp_error);
if (temp_error)
{
g_propagate_error (error, temp_error);
goto out;
return FALSE;
}

/* Read the null byte */
(void)g_data_input_stream_read_byte (datastream, cancellable, NULL);

if (!ostree_repo_resolve_rev (repo, revision, FALSE, &resolved_commit, error))
goto out;
return FALSE;

if (!process_one_checkout (repo, resolved_commit, subpath, target, cancellable, error))
{
g_prefix_error (error, "Processing tree %s: ", resolved_commit);
goto out;
return FALSE;
}

g_free (revision);
}
if (temp_error)
{
g_propagate_error (error, temp_error);
goto out;
return FALSE;
}

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

gboolean
Expand Down

0 comments on commit ee1e585

Please sign in to comment.